Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WorkflowInstance::Terminate Method (String^)

 

Terminates the workflow instance in a synchronous manner.

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public:
void Terminate(
	String^ error
)

Parameters

error
Type: System::String^

A description of the reason for terminating the workflow instance.

Exception Condition
InvalidOperationException

The workflow runtime engine is not running.

The workflow instance is terminated in a synchronous manner. The host calls Terminate to terminate the workflow instance. The workflow runtime engine clears the in-memory workflow instance and informs the persistence service that the instance has been cleared from memory. For the SqlWorkflowPersistenceService, this means that all state information for that workflow instance is deleted from the database upon termination. You will not be able to reload the workflow instance from a previously stored persistence point.

After the in-memory workflow instance is cleared and the persistence service is informed of the termination, the Terminate method raises the WorkflowTerminated event and passes reason in the Message property of a WorkflowTerminatedException contained in the WorkflowTerminatedEventArgs.

Terminate is different from Abort in that while Terminate clears the in-memory workflow instance and informs the persistence service of the termination, Abort simply clears the in-memory workflow instance, which can then be restarted from the last persistence point.

The following code example demonstrates calling Terminate on a WorkflowInstance object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft