Muokkaa

Jaa


TrackingWorkflowExceptionEventArgs.Exception Property

Definition

Gets the Exception that is being thrown by the workflow instance.

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

Property Value

The exception that is being thrown by the workflow instance.

Examples

The following code example demonstrates a method, named WriteExceptionEventArgs, which captures a TrackingWorkflowExceptionEventArgs. 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 converts the value of the OriginalActivityPath property to a string and writes it 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.

static void WriteExceptionEventArgs(string eventDescription, TrackingWorkflowExceptionEventArgs exceptionEventArgs, DateTime eventDataTime)
{
    Console.WriteLine("\nException Event Arguments Read From Tracking Database:\n");
    Console.WriteLine("EventDataTime: " + eventDataTime.ToString());
    Console.WriteLine("EventDescription: " + eventDescription);
    if (null != exceptionEventArgs.Exception)
    {
        Console.WriteLine("ExceptionEventArgs Exception Message: " + exceptionEventArgs.Exception.Message.ToString());
    }
    Console.WriteLine("ExceptionEventArgs Original Activity Path: " + exceptionEventArgs.OriginalActivityPath.ToString());
}
Shared Sub WriteExceptionEventArgs(ByVal eventDescription As String, ByVal exceptionEventArgs As TrackingWorkflowExceptionEventArgs, ByVal eventDataTime As DateTime)
    Console.WriteLine(vbCrLf + "Exception Event Arguments Read From Tracking Database:")
    Console.WriteLine("EventDataTime: " + eventDataTime.ToString(CultureInfo.CurrentCulture))
    Console.WriteLine("EventDescription: " + eventDescription)
    If exceptionEventArgs.Exception IsNot Nothing Then
        Console.WriteLine("ExceptionEventArgs Exception Message: " + exceptionEventArgs.Exception.Message.ToString())
    End If
    Console.WriteLine("ExceptionEventArgs Original Activity Path: " + exceptionEventArgs.OriginalActivityPath.ToString())
End Sub

Applies to

See also