01-28-2016 02:15 PM
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.
01-29-2016 02:40 AM
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
01-29-2016 10:53 AM
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.
02-01-2016 02:01 PM
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
02-02-2016 01:32 PM
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..
02-03-2016 02:03 AM
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
06-19-2023 08:35 PM
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.