WorkflowApplicationAbortedEventArgs.Reason 属性

定义

获取提供有关工作流实例中止原因信息的异常。Gets the exception that provides information about why the workflow instance was aborted.

public:
 property Exception ^ Reason { Exception ^ get(); };
public Exception Reason { get; }
member this.Reason : Exception
Public ReadOnly Property Reason As Exception

属性值

Exception

提供有关工作流实例中止原因信息的异常。The exception that provides information about why the workflow instance was aborted.

示例

下面的代码示例检查传递给 WorkflowApplicationAbortedEventArgs 实例的 Aborted 处理程序的 WorkflowApplication,并显示有关工作流中止原因的信息。The following code example inspects the WorkflowApplicationAbortedEventArgs passed into the Aborted handler of a WorkflowApplication instance and displays information about why workflow was aborted.

wfApp.Aborted = delegate(WorkflowApplicationAbortedEventArgs e)
{
    // Display the exception that caused the workflow
    // to abort.
    Console.WriteLine("Workflow {0} Aborted.", e.InstanceId);
    Console.WriteLine("Exception: {0}\n{1}",
        e.Reason.GetType().FullName,
        e.Reason.Message);
};

注解

当由 WorkflowApplication 承载的工作流中止时,将调用 Aborted 处理程序,而不调用 Completed 处理程序。When a workflow hosted by a WorkflowApplication is aborted, the Aborted handler is invoked and the Completed handler is not invoked.

适用于