TrackingWorkflowTerminatedEventArgs::Exception Property
Gets the exception that caused the workflow instance to be terminated.
Assembly: System.Workflow.Runtime (in System.Workflow.Runtime.dll)
Property Value
Type: System::Exception^The System::Exception that caused the workflow instance to be terminated.
When the workflow instance is terminated because of an unhandled exception, Exception contains the unhandled exception.
When the workflow instance is terminated by either a host call to WorkflowInstance::Terminate or by a TerminateActivity activity, Exception contains a WorkflowTerminatedException that has its Message property set to a description of the reason for the termination. If the host terminates the workflow instance, it supplies this description in the string parameter to WorkflowInstance::Terminate; if the workflow instance is terminated by a TerminateActivity, the description is supplied by TerminateActivity::Error.
The following code example demonstrates a method, named WriteTerminatedEventArgs, which captures a TrackingWorkflowTerminatedEventArgs. The code checks whether the Exception property is null (Nothing in Visual Basic). If it is not, the code writes the message associated with the Exception property to the console. If Exception is null (Nothing), the code does not write any exception information to the console.
This code example is part of the EventArgs Tracking SDK Sample from the Program.cs file. For more information, see EventArgs Tracking Sample.
Available since 3.0
TrackingWorkflowTerminatedEventArgs Class
System.Workflow.Runtime.Tracking Namespace
EventArgs Tracking Sample