September 2010
Intermediate to advanced
272 pages
5h 16m
English
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.
Create a new Workflow Console Application and name it ErrorHandling.
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 ...