04-18-2013 05:18 PM
I am calling a .net dll, but a 1172 error occured. I tried to chase down the problem, and I saw that the reference type after the constructor is null (see attached). Can it be null? I try to read one of its property immediately, and I got the error. Any thoughts on that?
04-18-2013 10:57 PM - edited 04-18-2013 10:59 PM
@jyang72211 wrote:
I am calling a .net dll, but a 1172 error occured. I tried to chase down the problem, and I saw that the reference type after the constructor is null (see attached). Can it be null? I try to read one of its property immediately, and I got the error. Any thoughts on that?
From your posts on this forum it sounds like you're doing a lot of .net integration work...
As far as a Null reference out of constructor goes - if an exception is encountered in the constructor, the assignment of the reference to the new object never occurs (since an object if first created, memory assigned, constructor called to perform any work and only then the created object reference is assigned). So the reference is null. Calling any property / method etc. on this null reference would obviously not work and produce an error.
EDIT: Found this link, might help you out - http://stackoverflow.com/questions/10119896/why-throwing-exception-in-constructor-results-in-a-null-...
Error 1172 is the LabVIEW catch-all for .Net exceptions. In later versions of LabVIEW (8.0 and later I think) the error string value contains the actual Exception.Message contents. You don't give a lot of details but I'm sure the contents of the Error Cluster would be helpful to understand what error the constructor node is generating. Might tell you what is going wrong in the constructor....