12-01-2023 02:02 AM
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
12-01-2023 05:29 AM
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
12-01-2023 06:09 AM
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.
12-01-2023 08:48 AM
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,
FileGlobals.ObjectReference1 = FileGlobals.ObjectReference2?
12-04-2023 12:10 AM
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.
12-04-2023 02:37 AM
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?
12-04-2023 06:34 AM
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.
12-04-2023 09:32 AM
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 😉