Termination Monitor - .NET

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)


This example demonstrates the use of the Termination Monitor function in .NET. The Termination Monitor allows a code module to stop executing if TestStand attempts to terminate or abort the execution.

Example File Location

Open Example

<TestStand Public>\Examples\Fundamentals\Termination Monitor\dotNET\Termination Monitor.seq

Highlighted Features

Major API




How to Use This Example

This example uses a .NET Action step to call a function in a .NET assembly that runs indefinitely. Since it uses the Termination Monitor functionality, the function is able to stop when TestStand attempts to terminate or abort execution. If the function did not call the Termination Monitor method, TestStand would be unable to terminate or abort the execution.

To review the functions used in this example, open Termination Monitor Example Form.cs located at <TestStand Public>\Examples\Fundamentals\Termination Monitor\dotNET\Termination Monitor Example\Termination Monitor Example Form.cs.

In the InitializeTerminationStateChecking()method, notice that the Execution.InitTerminationMonitor method from the TestStand API is used to initialize the termination monitor and obtain a reference to data required by other Termination Monitor functions. Every 100 milliseconds, the state of the execution is queried with the Execution.GetTerminationMonitorStatus method from the TestStand API. If TestStand is attempting to terminate or abort the execution, this code module finishes its execution.

Complete the following steps to run the example:

  1. In TestStand, select Execute»Single Pass to run the sequence.
  2. When the TerminationMonitorExample dialog appears, the sequence will execute indefinitely.
  3. On the Debug toolbar in TestStand, click the red Terminate button to terminate the execution. Observe that the execution terminates successfully.


Not Helpful