This documentation is archived and is not being maintained.

Using the TerminateActivity Activity

When an abnormal situation occurs, you can use a TerminateActivity activity to immediately end all activities of a running workflow instance.

The TerminateActivity activity logs an error when a workflow instance terminates. You can specify a message string to accompany the error to help the administrator diagnose the problem by using the TerminateActivity Error property; however, a message string is not required.

If you put a TerminateActivity activity in a ParallelActivity activity, and the branch that has the TerminateActivity activity on it is run, the instance finishes immediately, regardless of whether other branches have finished running. Depending on your design, results might be unpredictable in such a case.

For more information, see the TerminateActivity class of the System.Workflow.ComponentModel namespace in the Windows Workflow Foundation Class Library reference.

For a code sample that demonstrates how to use the TerminateActivity activity, see Using Suspend and Terminate.

See Also