From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error by loading of a .NET assembly from a specified path

Solved!
Go to solution

Hi!

I have got a DLL  with a .NET class interface for using this DLL  in LabView.  The author of this DLL (an experienced software developer) made for me an example VI, which he put together with corresponding DLLs in a directory.

As I copied this directory to my location and  started VI  the LabView couldn't load constructor from the assemly with a general error " An error occurred trying to load the assemly". As I mentioned, the DLL was placed in the same directory with the VI and I pointed to it by pressing "Browse..." button by "Select. NET Constructor". I read NI knowlegde base and built a prooject, where I included the VI and the corresponding DLL. It was still impossible to load the assembly. Then I editied the "Path" in "Options", putting he directory with the DLL in the path for VI searching. Nothing happened.

Only after I copied the DLL in the directory where LabView.exe is located I could load the assembly. This way is not the most appropriate, because I don't have the administrator's right on all PCs where I work. It is not clear for me, why the LabView is not able to load the assembly from a defined directory. In any case it can display its name and version info.

I use LabView2009 (and tried the same with LabView 8.2), Microsoft .NET Frameword 3.5 and its SP1 are installed on my machive (OS Windows XP).

 I add the pic of an error occurring during the loading of the assembly, will add the VI or the project if it would be necessary to find out what's wrong .

I thank you in advance for any ideas.

Natalie 

 

0 Kudos
Message 1 of 13
(3,659 Views)
0 Kudos
Message 2 of 13
(3,652 Views)

Thank you for your suggestion: the solution you sent me is similar to my own - to copy the DLL into LabView.exe directory or, as your link says, to include it in GAC. Both means that one needs administrator rights, what is not a common case. LabView Hepl says, that it should work when I put the DLL in a project directory, I want to find out why it doesn't work.

 

0 Kudos
Message 3 of 13
(3,644 Views)
Check if your DLL uses public static functions. If so, there's no need to call the constructor.
0 Kudos
Message 4 of 13
(3,637 Views)

The author of the DLL has written it in such a way that it is necessary to create a constructor in order to use properties and methods of 2 classes, which he put in the DLL. He told me , that all functions are public.

On the other hand, the LabView doesn't say that there are no constructors there, it says, that it is error by loading assembly :-(.

0 Kudos
Message 5 of 13
(3,634 Views)

Load the DLL with Lutz Roeder's .net reflector and look at it's dependencies. Maybe this gives you a hint.

0 Kudos
Message 6 of 13
(3,629 Views)
Thank you for the tip, I'm just investigating it with "reflector".
0 Kudos
Message 7 of 13
(3,624 Views)
If you check the dependend assemblies look for National DLL's maybe the error is caused by recursive calls.
Message 8 of 13
(3,606 Views)

Hi, Christian!

I tried to open the DLL I talked about with "reflector" and it can't resolve it either. Does it mean, that the software developer has to do some changes ? Maybe it is a solution...

Thank you for sending me this tip  

 

0 Kudos
Message 9 of 13
(3,593 Views)

Is there an error when loading your dll to the reflector ? If it's on the left pane you can use the context menu to analyse or disassemble the dll.

If you have VisualStudio installed you can also try to reference the assembly in a simple project or use the VS Object Browser to have a look at it's interface.

0 Kudos
Message 10 of 13
(3,585 Views)