LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Releasing .NET references

I am trying to use a .NET dll from Labview. Attached is a screenshot of a stripped down version of the vi.

 

 

The vi first creates an instance of SystemClass. It then calls the Create method of this, to make an instance of a particular module. It then closes both references. This works finewhen the vi is run the first time, but if the vi is run again I get the following error on the first create:

 

"Error 1172 occurred at Error creating instance of SystemClass (System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {ADAE87A2-08FF-5AB6-9142-28549CDA1121} failed due to the following error: 800700b7.
) in Test2.vi"

 

 The SystemClass is a singleton, so only one instance can be created. As far as I can work out this means that Labview has never closed the reference to the original SystemClass, so when vi runs again, it attempts to create another instance of SystemClass, giving an error.

 

If anyone has a solutions or workarounds to this problem would be appreciated.

 

Charlie

 

 

 

0 Kudos
Message 1 of 4
(2,589 Views)

I think you forget the attachment. Also search the forum and if this didn't helped you, kindly post back.

 

Thanks,

Mathan

0 Kudos
Message 2 of 4
(2,587 Views)
I suspect your problem has more to do with COM than with LaVIEW. You seem to be creating a COM reference within your .NET object. If you are not explicitly closing this reference within your .NET class, then LabVIEW can't close it since it has no visibility to it. Try the following: Add a "Close" method to your class and within it explicitly close your COM reference. Call this method before you close your .NET reference. I suggest this method rather than trying to use the class destructor since you at least have control over it this way.
0 Kudos
Message 3 of 4
(2,574 Views)

If you are interested in .Net and LabVIEW, read the posts on Lycangeeks blog on programming. A lot of info to the why and how of .net in LabVIEW.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 4
(2,552 Views)