LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.net event callback VIs - Why do they never leave running state?

Solved!
Go to solution

Any update in 2020?

Works for me if gc.collect is called manually after stopping all related VIs.

Would be glad if something could be called from the running VI after closing all related .NET references.

0 Kudos
Message 31 of 33
(860 Views)

Since there is still some chatter about this not working in LV 2018, I wanted to point out that this work-around is working for me in 32-bit LV 2018.

GC Collect - LV2018.png

Download All
0 Kudos
Message 32 of 33
(770 Views)

@Adam_S wrote:

Hi Mike,

 

I was able to find a document that provided a potential work-around for the issue you are describing:

 

.NET Callback Event VI keeps the Callback VI reserved even after calling a Close Reference VI is called
For example, when running the "Passing data to a .NET Event Callback.vi" example, after stopping the main example VI, the "Callback - EventHappened.vi" is still reserved.

Workaround: I've come up with a work around for this problem. GC.Collect() can be called manually from the invoke node in a separate VI(Or the user could call it after un-registering the callback). This would un-reserve the callback VI. Steps : 1. Drop an invoke node in an empty VI 2. Right click on the node and in the menu under "Select Class" -> ".NET" choose Browse. 3. In the Class browser dialog navigate to mscorlib(4.0.0.0) assembly in the drop down 4. Once selected in the list below expand the system namespace and choose GC class. 5. Once this is done you can choose the Collect() static method. 6. You can unreserve the callback VI by running this VI.

Reported Version: 2013 SP1    Resolved Version: N/A    Added: 05/07/2014

 

Notice that this is valid for LabVIEW 2013, though I had no issues running this example on LabVIEW 2015.  I got this information from the following url:

 

http://www.ni.com/product-documentation/52150/en/#468139_by_Category

 

Hope this helps!

 


I know this is old, but just wanted to point out that it still works fine in LV2019. I'll try it later with newer versions.

 

Thanks for the tip!

0 Kudos
Message 33 of 33
(417 Views)