09-11-2018 03:15 PM - edited 09-11-2018 03:19 PM
In teststand I'm using the batch model. The workspace consists of several sequence files each containing several sequences/callbacks. Number of sockets = N
In the pre-batch callback, for each test socket, I call a LabVIEW class constructor method which does the following:
-Instantiates a LabVIEW class (name: NXP) -In the constructor: instantiate a .NET class (name:NXPSSH) and store its reference in a property.
-Return reference of NXP.
//So this LabVIEW object (NXP) has a reference property to a .NET object (NXPSSH).
I assign the returned reference to an object reference in
ModelData.TestSockets[i].UUT.AdditionalData.NewSubProperty("Reference", PropValType_Reference, False, "", 0),
ModelData.TestSockets[i].UUT.AdditionalData.Reference = Locals.NXPReference
At this point each test socket has a reference to one LabVIEW NXP object which in turn has a reference to one .NET NXPSSH object.
My questions:
When I test my application, 80% of the time it works well, but sometimes I get invalid references when I call the NXP methods which call the NXPSSH methods. It seems to me that the reference to the NXPSSH object somehow gets deleted/invalid. Perhaps because they are in separate application domains. I know that LabVIEW deletes all the references when the caller VI finishes executing. But in this case I'm literally storing the NXPSSH refence object in a class property.
Solved! Go to Solution.
09-12-2018 11:13 PM
So I am not familiar with the .NET constructor you are referring but here is my experience with what you are doing.
To keep a reference valid you have either hold it open in TestStand and pass it to each VI that needs it or use the concept used in Actor Framework and create a VI that's holds the reference open and then send a message to the VI that closes it at the end.
I have worked with a customer that uses a VeriStand for TestStand add-on that uses .NET and in this ad-hoc each step obtains the VeriStand reference so this makes me assume .NET is doing some type of clean up which is causing your reference lose.
If you can provide a bit more detail as to what you are doing I may be able to help you a bit more with the solution.