Additional Information
TestStand cannot unload a .NET assembly from memory until TestStand unloads all steps that call into the .NET assembly and you release all objects created from the assembly. During execution of a sequence, TestStand maintains a run-time copy of FileGlobals and this copy is referenced by an Execution object. An Execution object that completes does not release references to FileGlobals, because the execution might still need them if it is restarted. An Execution object releases its references to FileGlobals when the Execution object is destroyed, typically when you close the Execution window.
If you store a .NET object reference in a FileGlobal variable, TestStand does not release the reference to the object until the variable is set equal to Nothing (see Special Constant Values for more details) or until TestStand releases all references to the parent FileGlobals container. Therefore, if you do not set the variable holding the reference equal to Nothing, .NET cannot destroy the object and TestStand cannot unload the assembly from memory until after you close the Execution window. TestStand effectively ignores step and sequence file unload options and any unload all module operations.
For example in TestStand 3.1, if you store a .NET object reference in a FileGlobal variable and pass a SequenceContext object that refers to the FileGlobals to a method of a .NET object, .NET releases its reference to the parameter after returning from the method and places the parameter reference in garbage collection. The undestroyed parameter maintains its reference to FileGlobals, so FileGlobals are not released until the next garbage collection occurs. The only workaround is to explicitly set the FileGlobal variable to Nothing, or call GC.Collect in a code module before completing the execution and closing the Execution window.
In TestStand 3.5 and later, the .NET adapter will periodically request .NET to garbage collect released objects to finalize their destruction and remove them from memory. This interval is set to a default of 3 seconds, but you can configure it manually by modifying the property Engine.DotNetGarbageCollectionInterval.