Using the Suspend Activity

Another housekeeping activity you might find useful under certain conditions is the Suspend activity. In fact, a common-use case is to handle a fault using FaultHandler and then suspend the activity using Suspend to signal human intervention is required.

When you use the Suspend activity, you provide the activity with an error string through its Error property. This property can be bound to a dependency property (such as the Throw activity), a simple class property or field, or even a literal string (which we’ll do in the example to follow). When Suspend executes, the workflow runtime raises the WorkflowSuspended event and provides you with this error string in the event arguments.

Putting a workflow instance into a suspended ...

Get Microsoft® Windows® Workflow Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.