SuspendActivity.Error 属性

定义

获取或设置向管理员报告的错误消息,该错误消息提供挂起的原因。

public:
 property System::String ^ Error { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(true)]
public string Error { get; set; }
[<System.ComponentModel.Browsable(true)>]
member this.Error : string with get, set
Public Property Error As String

属性值

提供工作流实例挂起原因的错误消息。 默认值是 null

属性

示例

此示例演示如何初始化 ErrorSuspendActivity 属性,以及在别处讨论的与此有关的其他概念。

此代码示例摘自 SuspendAndTerminateWorkflow.Designer.cs 文件中的“挂起和终止 SDK”示例。 有关详细信息,请参阅 使用挂起和终止

[System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
    this.CanModifyActivities = true;
    this.suspend = new System.Workflow.ComponentModel.SuspendActivity();
    this.consoleMessage = new System.Workflow.Activities.CodeActivity();
    this.terminate = new System.Workflow.ComponentModel.TerminateActivity();
    //
    // suspend
    //
    this.suspend.Error = null;
    this.suspend.Name = "suspend";
    //
    // ConsoleMessage
    //
    this.consoleMessage.Name = "consoleMessage";
    this.consoleMessage.ExecuteCode += new System.EventHandler(this.OnConsoleMessage);
    //
    // terminate
    //
    this.terminate.Error = null;
    this.terminate.Name = "terminate";
    //
    // SuspendAndTerminateWorkflow
    //
    this.Activities.Add(this.suspend);
    this.Activities.Add(this.consoleMessage);
    this.Activities.Add(this.terminate);
    this.Name = "SuspendAndTerminateWorkflow";
    this.CanModifyActivities = false;
}
<System.Diagnostics.DebuggerNonUserCode()> _
                            Private Sub InitializeComponent()

    Me.CanModifyActivities = True
    Me.suspend = New System.Workflow.ComponentModel.SuspendActivity()
    Me.consoleMessage = New System.Workflow.Activities.CodeActivity()
    Me.terminate = New System.Workflow.ComponentModel.TerminateActivity()
    ' 
    ' suspend
    ' 
    Me.suspend.Error = Nothing
    Me.suspend.Name = "suspend"
    ' 
    ' ConsoleMessage
    ' 
    Me.consoleMessage.Name = "consoleMessage"
    AddHandler Me.consoleMessage.ExecuteCode, AddressOf Me.OnConsoleMessage
    ' 
    ' terminate
    ' 
    Me.terminate.Error = Nothing
    Me.terminate.Name = "terminate"
    ' 
    ' SuspendAndTerminateWorkflow
    ' 
    Me.Activities.Add(Me.suspend)
    Me.Activities.Add(Me.consoleMessage)
    Me.Activities.Add(Me.terminate)
    Me.Name = "SuspendAndTerminateWorkflow"
    Me.CanModifyActivities = False
End Sub

注解

此错误消息的传播由宿主(实例管理器或永久性提供程序)确定。

适用于