This documentation is archived and is not being maintained.

Using Tracking to Troubleshoot Applications

This topic applies to Windows Workflow Foundation 4 (WF4).

Windows Workflow Foundation (WF) enables you to track workflow-related information to give details into the execution of a Windows Workflow Foundation application or service. Windows Workflow Foundation hosts are able to capture workflow events during the execution of a workflow instance. If your workflow generates faults or exceptions, you can use the Windows Workflow Foundation tracking details to troubleshooting its processing.

Troubleshooting a WF using WF Tracking

To detect faults within the processing of a Windows Workflow Foundation activity, you can enable tracking with a tracking profile that queries for an ActivityStateRecord with the state of Faulted. The corresponding query is specified in the following code.

              <activityStateQuery activityName="*">
                  <state name="Faulted" />

If a fault is propagated and handled within a fault handler (such as a TryCatch activity) this can be detected using a FaultPropagationRecord. The FaultPropagationRecord indicates the source activity of the fault and the name of the fault handler. The FaultPropagationRecord contains fault details in form of the exception stack for the fault.The query to subscribe for a FaultPropagationRecord is shown in the following example.

              <faultPropagationQuery faultSourceActivityName ="*" faultHandlerActivityName="*"/>

If a fault is not handled within the workflow it results in an unhandled exception at the workflow instance and the workflow instance is aborted. To understand the details of the unhandled exception, the tracking profile must query the workflow instance record with state name=”UnhandledException” as specified in the following example.

                  <state name="UnhandledException" />

When a workflow instance encounters an unhandled exception, a WorkflowInstanceUnhandledExceptionRecord object is emitted if Windows Workflow Foundation tracking has been enabled.

This tracking record contains the fault details in the form of the exception stack. It has details of the source of the fault (for example, the activity) that faulted and resulted in the unhandled exception.To subscribe to fault events from a Windows Workflow Foundation, enable tracking by adding a tracking participant. Configure this participant with a tracking profile that queries for ActivityStateQuery (state=”Faulted”), FaultPropagationRecord, and WorkflowInstanceQuery (state=”UnhandledException”).

If tracking is enabled using the ETW tracking participant, the fault events are emitted to an ETW session. The events can be viewed using the Event Viewer event viewer. This can be found under the node Event Viewer->Applications and Services Logs->Microsoft->Windows->Application Server-Applications in the analytic channel.

See Also