Using the CancellationHandlerActivity Activity
The CancellationHandlerActivity activity contains cleanup logic for a composite activity that is canceled before all the composite activity's child activities are finished executing. A CancellationHandlerActivity activity cannot exist on its own; it is always associated with another activity.
For example, a ListenActivity activity or a ConditionedActivityGroup activity can have multiple child branch activities executing at once. A specific condition, such as an arriving message, can cause the entire activity to close immediately, before all the child activities are finished executing. The parent activity then cancels the execution of all uncompleted child activities, and their corresponding CancellationHandlerActivity activity is called to perform the cleanup logic defined there.
For more information about the CancellationHandlerActivity activity, see the CancellationHandlerActivity class of the System.Workflow.ComponentModel namespace in the Windows Workflow Foundation Class Library reference.