Assigning Values to Object References
- Updated2025-07-23
- 2 minute(s) read
Object reference properties can contain references to LabVIEW, .NET, ActiveX/COM, and other objects. When a property is an object reference, you can use the Release Object button, which displays only when the value of the property is non-zero, in the Value column on the Variables pane to release the reference.
You can set the reference value by using an expression, using the TestStand API, or configuring a call to a code module with a parameter or return value that returns such an object.
When you have two object reference properties and use the equality operator in an expression, TestStand performs an equality comparison on the IUnknown pointers for ActiveX objects and the pointer values for .NET objects.
Releasing References to Objects
When you assign an object reference value to an object reference property, TestStand maintains a reference to the object for as long as the property exists, or until the value changes. TestStand automatically releases the reference to the object when the property loses scope. For example, when a sequence local variable contains a reference to an object, TestStand releases the reference when the call to the sequence completes.
You can also release the reference to the object by assigning the property a new value or the constant Nothing. Assign the constant Nothing, rather than the value 0, to clear the reference. When you assign 0 to an object reference variable, TestStand creates a numeric variable with a value of 0 and assigns a reference to that numeric variable to the object reference variable.
When you release all references to an object, the availability of the object after release changes depending on the type of object, as shown in the following table.
| Type of Object | Object Availability |
|---|---|
| .NET | The object is available for .NET garbage collection. |
| ActiveX/COM | The object is destroyed. |