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

It is a static .NET method, there is no need of constructur.

 

1) Just place the .NET Invoke node and right-click on reference and "Create->Constant". 

2) Right-click in the constant and "Select .NET class".

3) Select mscorlib 4.0.0 and the System.GC (same as in your picture).

4) In the Invoke node, now you can select the [S]Collect method. The [S] indicates that it is a static method.

 

0 Kudos
Message 21 of 33
(1,773 Views)

This doesn't seem to work for me, LV2018SP1

0 Kudos
Message 22 of 33
(1,659 Views)

@toddy wrote:

This doesn't seem to work for me, LV2018SP1


What doesn't work for you?

 

They keep hanging? That is the bug we're talking about...

 

Or they don't hang for you (the bug isn't working)?

0 Kudos
Message 23 of 33
(1,648 Views)

@toddy wrote:

This doesn't seem to work for me, LV2018SP1


When you say "this", you're replying to a 3 year old thread that has been resurrected many times before and has many solutions and techniques posted.  What exactly is the "this" that doesn't work?

 

You might have better luck in a new thread that's not already marked as "solved".  A lot of the time people don't read threads that don't need a solution any more.

 

0 Kudos
Message 24 of 33
(1,646 Views)

Sorry if I wasn't clear. The 'This' that isn't working is the workaround.

https://www.ni.com/en/support/documentation/bugs/19/labview-2019-and-2019-sp1-known-issues.html

"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: Call GC.Collect() from an invoke node after closing the Callback VI's reference or in a separate VI to un-reserve the callback VI. This workaround does not work in LabVIEW 2018."

 

According to this article (and my own very recent experience) the Collect function doesn't work as a workaround in LV2018.

 

Unfortunately I don't have the option of changing which version I'm using, so I'm having to close and re-open the project if I want to edit the callback vi

I didn't start a new post, as this is the post that people will find if they are searching for this issue, and hopefully this information will be useful.

0 Kudos
Message 25 of 33
(1,614 Views)

Do you use callbacks for .NET callback events? Or for LabVIEW events?

0 Kudos
Message 26 of 33
(1,604 Views)

For .NET callback events.

0 Kudos
Message 27 of 33
(1,592 Views)

@toddy wrote:

For .NET callback events.


Are the callback VIs in a class or library?

 

That locks them (and the library) for me with LabVIEW callback events.

0 Kudos
Message 28 of 33
(1,586 Views)

No, in this case they aren't in a library. Perhaps it's just me but I generally find libraries seem to make things more complicated rather than less!

Initially as this was something new I was trying out the vis weren't even in a project, and in that situation you have to completely shut down labview to release them. At least now I 'only' have to close the project

0 Kudos
Message 29 of 33
(1,578 Views)

If you post a minimal reproducible example I can have a look in 18 and 20.

 

Not sure if it's worth the effort. If I can't reproduce it, I can't fix it. If I can reproduce it, I probably can't fit it either. 😁

0 Kudos
Message 30 of 33
(1,573 Views)