12-31-2013 06:20 PM
12-31-2013 08:05 PM
The c# program works properly and nothing is wrong with the dll. The problem is how to use that dll ( knowing the dependency between classes) in LabVIEW to not get the Null reference error . But thanks for your advice I will post it there
01-03-2014 05:52 AM - edited 01-03-2014 06:11 AM
Hi TinTin,
This error is purely a .NET exception, so an error is occuring somewhere within your library and an exception is being thrown that LabVIEW is picking up. To know why you are getting this error, you need to know exactly where it is occuring in the the C# code, and trace back through your DLL code to find the error that is occuring because it something is passing an invalid(Null) reference.
Does this C# DLL work when called from another language, such as C#, and have you checked that the parameters you are passing to the invoke node is correct for the function? I would advise exploring your class Diagram and trace through the possible routes where this null reference could occur. If this error occurs every time without fail then it points to an issue with the DLL which cannot be fixed through LabVIEW as LabVIEW is merely a client calling the functions within the library. It may be worth you seeking help on a dedicated, seperate C# forum who may be able to help you with debugging the code in your C# DLL.
Best Regards,
James Kent
01-05-2014 05:17 PM - edited 01-05-2014 05:30 PM
If your query is around how to find dependencies (such as other assemblies your additional types are defined in), LabVIEW uses the CLR strategy to find the missing assemblies: http://zone.ni.com/reference/en-XX/help/371361K-01/lvconcepts/net_defaults/. Note also that optional arguments are only partially supported in LabVIEW: http://digital.ni.com/public.nsf/allkb/DC41DCDA972642CF8625787E00732DDD. Additionally those first set of constructors in your error picture don't make any sense - the .Net reference output is not used. Why construct something you are not using?
I am inclined to agree with the other posters here - Error 1172 is an error that wraps all .Net Exceptions that are thrown however the error source element only includes the message, not any additional items such as a StackTrace. If you have the option, I would suggest using a debugger (such as Visual Studio Professional or higher, or the free SharpDevelop) to connect to LabVIEW and debug the call to your .net dll. This will tell you exactly where the issue is (ie. what call is generating the Null Reference Exception).
Without any actual code (eg. all the C# classes and dependencies) it is difficult for us to debug this any further.
01-06-2014 03:54 AM
@tintin_99 wrote:
Basically the problem is how to manage dependency between c# classess in LabVIEW. In c# "using take care of dependencies" and I thought when I create a dll all these dependencies will be added and LV doesn't care about dependencies inside this dll
Dependencies are not automatically added to your DLL. Your DLL only will contain the code that you have included in your project and the necessary dynamic linking wrappers for whatever other libraries your code uses. If those libraries are present on your computer or not is your responsibility as component developer by adding the installers for those components to the installer of your own component.