Skip to Content
Microsoft Windows Workflow Foundation 4.0 Cookbook
book

Microsoft Windows Workflow Foundation 4.0 Cookbook

by Andrew Zhu
September 2010
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 16m
English
Packt Publishing
Content preview from Microsoft Windows Workflow Foundation 4.0 Cookbook

Handling errors

In this task, we are going to create a Sequence workflow with a TryCatch activity. There will be a dividend assigned with zero, and hence we can generate a divide-by-zero exception deliberately so that we can handle this error in a TryCatch activity.

How to do it...

  1. Create a workflow project:

    Create a new Workflow Console Application and name it ErrorHandling.

  2. Create a code workflow:

    Create a new class file and name it ErrorHandlingWorkflow.cs. Fill the file with the following code:

    using System; using System.Activities; using System.Activities.Statements; namespace ErrorHandling { public class ErrorHandlingWorkflow{ public Activity GetInstance() { Variable<int> divisor = new Variable<int>("divisor", 10); Variable<int> dividend = new ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Essential Windows Workflow Foundation

Essential Windows Workflow Foundation

Dharma Shukla, Bob Schmidt

Publisher Resources

ISBN: 9781849680783Other