LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1 when passing .NET reference between VIs in TestStand sequence

I've developed a .NET assembly to be called inside a TestStand sequence by some VIs owned by the same lvlib library.

In the first TS sequence step a VI (init.vi) calls the .NET class constructor (inside a subVI) and then a class method (inside another subVI) with no errors. The .NET reference is then saved in a functional global as a last action before init.vi end.

In the following TS step a VI retrieves the .NET reference from the functional global and calls a .NET method (inside a subVI). The property node that calls the method always returns "Error 1". By putting a probe at the property node reference input I see that the reference number being passed has the same value as the one initially saved in the functional global, but it is also marked as "no longer valid.

 

Before creating a background running VI to be used as a storage for the .NET reference (in order to avoid garbage collector to dispose the reference at the end of the init.vi execution), I was wondering is there is a more simple alternative to this.

To my knowledge TS keeps all the library's VIs in memory until the end of the sequence execution and this should be enough to keep the reference alive...or not?

 

Thank you for reading

 

Best

 

0 Kudos
Message 1 of 3
(1,797 Views)

What is the Unload Option set for the sequence file (https://zone.ni.com/reference/en-XX/help/370052W-01/tsref/infotopics/db_seq_file_prop_gen_tab/)?

 

If the sequence file setting was "Use step unload option", what have you set to for the "init.vi" step (https://zone.ni.com/reference/en-XX/help/370052AA-01/tsref/infotopics/pane_step_settings_run_opt/)?

 

 

0 Kudos
Message 2 of 3
(1,740 Views)
Thank you for your suggestion tyk007. Actually all of the sequence steps are already set to unload when sequence file closes. In the meanwhile I've created a background running manager which works as expected. The research for an eventual more simple solution still goes on... Best
0 Kudos
Message 3 of 3
(1,726 Views)