01-10-2020 02:27 AM
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.
08-06-2020 10:52 AM
This doesn't seem to work for me, LV2018SP1
08-06-2020 11:20 AM
@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)?
08-06-2020 11:22 AM
@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.
08-07-2020 03:08 AM - last edited on 12-17-2024 10:04 AM by Content Cleaner
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.
08-07-2020 03:40 AM
Do you use callbacks for .NET callback events? Or for LabVIEW events?
08-07-2020 04:18 AM
For .NET callback events.
08-07-2020 04:55 AM
@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.
08-07-2020 05:41 AM
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
08-07-2020 06:25 AM
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. 😁