NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

When is the SequenceFileLoad callback executed and how to release the SequenceContext

I have added a SequenceFileLoad and a SequenceFileUnload callback to my process model.In SequenceFileLoad I am calling the constructor of a C# class with as argument the sequenceContext. In the SequenceFileUnload callback, I want to call a method in my class to properly release some objects.If the sequence is closed, this method is not called, why? The SequenceFileUnload callback is executed when TestStand is closed and not when the sequence is closed.At this moment I get the following errors… References to PropertyObjects were not released properly.    Total number of objects: 36676    Number of top-level objects: 92     Note: Some top-level objects may be included if they are referenced by    an incorrectly released top-level object. For example, an unreleased    SequenceContext object references a SequenceFile object.     The following top-level objects were not released:         SequenceContexts [1 object(s) not released]            SequenceContext #1:                The context last executed sequence 'SequenceFileLoad' in file 'TmgProcessmodel.seq'.            Files [1 object(s) not released]            SequenceFile #1:                Path: F:\Cat\TestStand\ProcessModels\TmgProcessmodel.seq How do I have to call the dispose method in my class when the sequence is closed?

How do I have to release the sequence context?

 

Best regards
0 Kudos
Message 1 of 6
(4,085 Views)

I have added a SequenceFileLoad and a SequenceFileUnload callback to my process model.
In SequenceFileLoad I am calling the constructor of a C# class with as argument the sequenceContext.
In the SequenceFileUnload callback, I want to call a method in my class to properly release some objects.

 

If the sequence is closed, this method is not called, why?

 

The SequenceFileUnload callback is executed when TestStand is closed and not when the sequence is closed.

At this moment I get the following errors…

 

References to PropertyObjects were not released properly.   

Total number of objects: 36676   

Number of top-level objects: 92    

Note: Some top-level objects may be included if they are referenced by   

an incorrectly released top-level object. For example, an unreleased   

SequenceContext object references a SequenceFile object.    

The following top-level objects were not released:        

SequenceContexts [1 object(s) not released]           

SequenceContext #1:               

The context last executed sequence 'SequenceFileLoad' in file 'TmgProcessmodel.seq'.           

Files [1 object(s) not released]           

SequenceFile #1:               

Path: F:\Cat\TestStand\ProcessModels\TmgProcessmodel.seq

 

How do I have to call the dispose method in my class when the sequence is closed?
How do I have to release the sequence context?

 

Best regards

0 Kudos
Message 2 of 6
(4,081 Views)

Hi cdds

 

What is the exact situation when closing the sequence file (is there a sequence still running, is there a test report opened... ?)

 

Make sure that when you close the sequence file, nothing else related to the sequence file is still opened in teststand (like a test report, or a currently running test which uses that sequence file etc...). Anything opened which is related to the sequence file will cause the sequence file to remain loaded in memory. So it will also prevent executing the sequencefileunload callback.

Best Regards

Michiel
Applications Engineer
NI Belgium
http://www.ni.com/ask
0 Kudos
Message 3 of 6
(4,059 Views)

Hi Michiel

 

The SequenceFileLoad callback is added to my process model.
If teststand starts, this callback will be executed at the time the login dialog is displayed and an empty default ‘Sequence File 1’ is loaded.
If the default ‘Sequence File 1’ is closed the SequenceFileUnload event is not executed.

Next if I load one of my sequences into TestStand, the SequenceFileLoad is event is not executed anymore, I suppose it should here.
If I close the sequence again immediately, even without running the sequence the SequenceFileUnload event is also not called.

The first time the SequenceFileLoad callback is executed, the SequenceContext is passed as argument in the constructor of my C# class.
So, when the SequenceFileUnload event should be executed, the SequenceContext object is of course still alive in my C# class. But if I have to dispose this instance in my class, at least the SequenceFileUnload event should be executed to be able to execute a method in my C# class.

Best regards

0 Kudos
Message 4 of 6
(4,053 Views)

Several issues:

 

1) You should not be using or holding onto the sequence context for the load callback after the load callback is done running. It is only meant to be used while the load callback is actually running. What is your C# class that your giving it to doing with it?

 

2) The SequenceFileLoad and Unload callbacks on the process model apply to the process model sequence file, not the client sequence file. That means it's called when the process model is loaded and unloaded, not when your client sequence file is loaded and unloaded. The process model is pretty much kept loaded most of the time until you call Unload all Modules, or exit teststand. What are you trying to use these callbacks for? Perhaps can use ProcessSetup and ProcessCleanup of the process model if what you are wanting to do is a one time setup/cleanup for each begin and end of the test uuts loop.

 

3) Are you using a Custom UI or the sequence editor? .NET introduces an additional problem for COM object releases because, unless you explicitly do some extra work, they are not released until the garbage collector gets around to it. The sequence editor works around this issue, your own custom UI might not.

 

Hope this helps,

-Doug

Message Edited by dug9000 on 03-19-2010 09:44 AM
0 Kudos
Message 5 of 6
(4,041 Views)

Hi ccds

 

Did you manage to solve your issue using dug's advise?

 

 

Best Regards

Michiel
Applications Engineer
NI Belgium
http://www.ni.com/ask
0 Kudos
Message 6 of 6
(3,977 Views)