LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

-6579: CDotNetCouldNotGetTypeInfoError

Solved!
Go to solution

Hi,

 

I have a "motor.dll" for my motor, which in turns uses "command.dll" (both .NET). Now I am trying to access motor.dll in my CVI project. The creation of .NET controller functions fine and I do not get any error, but when I try to initialize the motor using following code:

 

error = CDotNetRegisterAssemblyPath("Motor, Version=1.60.1.1, Culture=neutral, PublicKeyToken=null", Pfad_Motor); //till here error = 0
error = CDotNetRegisterAssemblyPath("Commands, Version=1.60.1.1, Culture=neutral, PublicKeyToken=null", Pfad_Commandos); //till here error = 0
error = Initialize_Motor(); //here error = -6579

int CVIFUNC Initialize_Motor(void) /*! Created by CVI SHOWS __assemblyHandle = 0*/
{
    int __error = 0;
    if (__assemblyHandle == 0)
        __errChk(CDotNetLoadAssembly(
            __assemblyName,
            &__assemblyHandle));
__Error:
    return __error;
}
 

I get -6579: CDotNetCouldNotGetTypeInfoError.

 

I do not have any idey, what I am doing wrong. I have used similar code for creating a dozen drivers for our devices.

 

By the way, in this case I do not have code for motor.dll and commands.dll.

 

Someone can help me here please?

 

Regards

RB


0 Kudos
Message 1 of 2
(3,204 Views)
Solution
Accepted by topic author dotNet_to_LabW

The CDotNetCouldNotGetTypeInfoError error code maps to the .NET TypeLoadException exception. You can find more about this exception here:

http://msdn.microsoft.com/en-us/library/system.typeloadexception.aspx

 

It seems like .NET is not able to locate some assembly or type. Some things to check would be:

 

1) Verify that the paths used in CDotNetRegisterAssemblyPath are correct.

 

2) Instead of using RegisterAssemblyPath, just put the motor and commands DLLs in the same directory as your executable and see if that works. If the motor assembly depends on the commands assembly, then .NET will try to load the commands assembly when needed. For this to work, the commands assembly (commands.dll) should be in the your executable's directory or in the Global Assembly Cache (GAC). CDotNetRegisterAssemblyPath is only useful when your CVI program needs to load some assembly and .NET is not aware of this path.

 

3) May be you are getting this error because of some other unresolved dependency. Check the header file that CVI generated for the motor assembly and the comments at the top of the file should indicate all the .NET dependencies of motor assembly, and make sure these dependencies are in the executable's directory or in the GAC.

Message 2 of 2
(3,175 Views)