NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can an object reference be prevented from being linked to the same object reference if a sequence is called multiple times?

Hi,

 

I have one seqeunce which creates a object reference and used this object reference to initialize a .NET adapter. This sequence is called multiple times by refering with parameters to another object reference. If the sequence has now been called twice, the last object reference created refers to all other object references. Is there a possibility  to create a object reference which is not linked to the previous created object reference if the sequence is called multiple times?

 

Thanks in advance

0 Kudos
Message 1 of 8
(1,339 Views)

Sounds like an incorrect assignment of references / variables.

You can also "reset" object references to Nothing if you want to make sure, no false ref is used

Message 2 of 8
(1,304 Views)

Thanks for the feedback!
I would like to continue using these object references in the main sequence after they have been initialized in the sequence. Therefore I do not want to set the object references as nothing. I have created an example sequence that might make it clearer.
In this sequence a separate .dll is used, I hope the sequence is still loaded correctly.

0 Kudos
Message 3 of 8
(1,297 Views)

Thanks for the example, this makes things clearer. Since I cannot execute it due to not haveing the .net Assembly

 

Are you saying that after executing the second step, 

Oli_Wachno_0-1701442092024.png

FileGlobals.ObjectReference1 = FileGlobals.ObjectReference2?

Message 4 of 8
(1,278 Views)

Yes exactly, the first ObjectReference is then no longer available and both FileGlobals.ObjectReference1 and FileGlobals.ObjectReference2 have the same ObjectReference from Init object reference 2.

0 Kudos
Message 5 of 8
(1,248 Views)

Tried to reproduce this behaviour using references to simple .net dictionaries:

failed to do so... Both references hold seperate values.

 

I have validated by simply comparing the reference values.

 

Can you try to reproduce the bahaviour you are seeing also with some kind of generic .net classes fròm the GAC?

Message 6 of 8
(1,236 Views)

Many thanks for your efforts so far.
I have now also extended the sequence with a comparison and I am now using the NationalInstruments.VISA.

The result of the comparison is saved in Locals.Bool.
If I only execute the sequence calls in the sequence, the object references are identical and if I only execute the individual steps, the object references are different.

 

I have attached a screenshot of each execution and also the current sequence.

0 Kudos
Message 7 of 8
(1,224 Views)

Thanks for this additional information.

 

Using the VISA .net (only have 19.xx. installed) assembly and TestStand 2021, I am able to reproduce what you are seeing.

 

Now.... If I am implementing the similarcode in 2019... no issues 

 

Downconverting your code to 2019 --> seeing the issues

Opening my 2019 code to 2021 --> no issues

 

Haven't found out the difference yet.... I am on it.... this is interesting 😉

 

Message 8 of 8
(1,209 Views)