TrackingWorkflowTerminatedEventArgs.Exception Propriedade
Definição
Obtém a exceção que fez a instância de fluxo de trabalho ser encerrada.Gets the exception that caused the workflow instance to be terminated.
public:
property Exception ^ Exception { Exception ^ get(); };
public Exception Exception { get; }
member this.Exception : Exception
Public ReadOnly Property Exception As Exception
Valor da propriedade
O Exception que fez com que a instância do fluxo de trabalho fosse encerrada.The Exception that caused the workflow instance to be terminated.
Exemplos
O exemplo de código a seguir demonstra um método, chamado WriteTerminatedEventArgs , que captura um TrackingWorkflowTerminatedEventArgs .The following code example demonstrates a method, named WriteTerminatedEventArgs, which captures a TrackingWorkflowTerminatedEventArgs. O código verifica se a Exception propriedade é null ( Nothing em Visual Basic).The code checks whether the Exception property is null (Nothing in Visual Basic). Se não estiver, o código gravará a mensagem associada à Exception propriedade no console.If it is not, the code writes the message associated with the Exception property to the console. Se Exception for null ( Nothing ), o código não gravará nenhuma informação de exceção no console.If Exception is null (Nothing), the code does not write any exception information to the console.
Este exemplo de código faz parte do exemplo de SDK de acompanhamento de EventArgs do arquivo Program.cs.This code example is part of the EventArgs Tracking SDK Sample from the Program.cs file. Para obter mais informações, consulte exemplo de acompanhamento de EventArgs.For more information, see EventArgs Tracking Sample.
static void WriteTerminatedEventArgs(string eventDescription, TrackingWorkflowTerminatedEventArgs terminatedEventArgs, DateTime eventDataTime)
{
Console.WriteLine("\nTerminated Event Arguments Read From Tracking Database:\n");
Console.WriteLine("EventDataTime: " + eventDataTime.ToString());
Console.WriteLine("EventDescription: " + eventDescription);
if (null != terminatedEventArgs.Exception)
{
Console.WriteLine("TerminatedEventArgs Exception Message: " + terminatedEventArgs.Exception.Message.ToString());
}
}
Shared Sub WriteTerminatedEventArgs(ByVal eventDescription As String, ByVal terminatedEventArgs As TrackingWorkflowTerminatedEventArgs, ByVal eventDataTime As DateTime)
Console.WriteLine(vbCrLf + "Terminated Event Arguments Read From Tracking Database:")
Console.WriteLine("EventDataTime: " + eventDataTime.ToString(CultureInfo.CurrentCulture))
Console.WriteLine("EventDescription: " + eventDescription)
If terminatedEventArgs.Exception IsNot Nothing Then
Console.WriteLine("TerminatedEventArgs Exception Message: " + terminatedEventArgs.Exception.Message.ToString())
End If
End Sub
Comentários
Quando a instância de fluxo de trabalho é encerrada devido a uma exceção sem tratamento, Exception contém a exceção sem tratamento.When the workflow instance is terminated because of an unhandled exception, Exception contains the unhandled exception.
Quando a instância de fluxo de trabalho é encerrada por uma chamada de host para WorkflowInstance.Terminate ou por uma TerminateActivity atividade, o Exception contém um WorkflowTerminatedException que tem sua Message propriedade definida como uma descrição do motivo da rescisão.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. Se o host encerrar a instância de fluxo de trabalho, ele fornecerá essa descrição no string parâmetro para WorkflowInstance.Terminate ; se a instância de fluxo de trabalho for encerrada por um TerminateActivity , a descrição será fornecida pelo TerminateActivity.Error .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.