This chapter covered quite a bit related to exceptions in workflow execution, how to handle these exceptions, and how to track down and diagnose issues with workflows and code. Exceptions are situational events that are not the norm. When these types of events come up, they must be gracefully handled, or things can go seriously wrong.
In Windows Workflow Foundation, exceptions are presented as faults. Workflow faults correspond directly to .NET types that inherit from the System.Exception class. There are several activities that directly support the concept of faults. The FaultHandlersActivity and FaultHandlerActivity classes are responsible for monitoring and gracefully handling faults that are raised during workflow execution. ThrowActivity enables you to initiate the throwing of a workflow fault. The CancellationHandler activity enables you to gracefully handle the situation if an activity’s execution is interrupted by the raising of a fault elsewhere in the workflow.
Because problems with workflows and code can occur due to bugs or other extraneous factors, there are several techniques available for tracking and logging these issues. This chapter discussed debugging in Visual Studio, .NET tracing, and performance counters. These techniques all have workflow-specific components that can assist you in the troubleshooting process.