LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET DLL

I built a .NET Interop Assembly with LabVIEW 2011 and a client to use it with a C# Forms App in Visual Studio 2015.  I added reference to the C# program for the Labview interop DLL and my DLL.  The Object Browser in Visual Studio shows the Labview Namespace, interop class and method syntax correctly.  But when I call the (static) method from C#, I get "TyepInitializationException was unhandled".  The method is static.. shouldn't require any initialization.

This only happens with DLLs from Labview 2011 (2015 works fine).  What is going on?  I have lots of 2011 code I would like to use.

 

0 Kudos
Message 1 of 7
(4,012 Views)

This sounds like there is an issue with the CLR version. Which version are you using and are you sure that your LV 2011 interop assembly uses the same version of CLR?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 7
(3,964 Views)

I looked at the manifest of the assembly for two LV .NET DLL's using the same source vi for both, one done with LV2011 and the other done with LV 2015.  They both had the comment "// Metadata version: v4.0.30319".  I think this means they used the same version of .NET, which I think means they used the same version of CLR.  The only difference in the manifests was that the 2015 version had the extern assembly "mscorlib" and the 2011 did not.  But when I tried to manually enter mscorlib as a reference in the 2011 build it told me that it was already included in the Global Assembly Cache..  I think I'm lost in the weeds.

0 Kudos
Message 3 of 7
(3,936 Views)

I think if you try the steps laid out in the following link, this should resolve your issue:

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configuring_clr_version/

 

Just as a reference, this article shows what .NET 4.0 features are unsupported in LabVIEW 2012 SP1 and earlier:

http://digital.ni.com/public.nsf/allkb/DC41DCDA972642CF8625787E00732DDD

Chris
0 Kudos
Message 4 of 7
(3,887 Views)

didn't work

getting "System.IO.FileNotFoundException" in NationalInstruments.LabVIEW.Interop.dll.

Inner Exception detail shows ""Missing Dependency in: "null"", with HResult = 80131500.

the stack trace shows the exception source as  "NationalInstruments.LabVIEW.Interop.LVRuntime.throwMissingDependencyException()"

I included "NationalInstruments.LabVIEW.Interop.dll" from the LabVIEW 2011 resource directory as a reference.

can't figure it out..

0 Kudos
Message 5 of 7
(3,848 Views)

Just one verification:

The system you work on has a working installation of LV 2011 RTE (RunTime Engine)?

If not, i guess that this is most likely the source of the issue.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 7
(3,824 Views)

Please check your project path address. The address should not contain any special characters. If there are special characters, the DLL generated by LabVIEW will result in this error.

0 Kudos
Message 7 of 7
(1,055 Views)