How to Debug Workflow With Workflow Manager 1.0 and Visual Studio 2012

Developing workflows are more interesting with Visual Studio 2012, WF 4.5 and Workflow Manger 1.0 .The method of debugging the workflow with the Workflow Manager is different from using other workflow hosting approaches. As a first step you need to install the Workflow Manager tool for Visual Studio, you could read more about the installation from this blog

To debug a workflow you need to first create a workflow using Visual Studio.  For example I have created a workflow as in the following in Visual Studio. This is a sequential workflow with two custom activities.


For example a Visual Studio project structure looks as in the following with a console application, class library and activity library.


My next step is to build my project and copy the Activity Library DLL to the folder "C:\Program Files (x86)\Workflow Manager Tools\1.0" where the Microsoft.Workflow.TestServiceHost exe resides.

This step is required only if you are debugging, otherwise copy to the following locations: "C:\Program Files\Workflow Manager\1.0\Workflow\WFWebRoot\bin", "C:\Program Files\Workflow Manager\1.0\Workflow\Artifacts".

Create a XML file call "AllowedTypes.xml" and specify the type as trusted type (You can learn more in Workflow Manager Trusted Surface).

Assembly Name="SampleActivityLibrary">
Namespace Name="SampleActivityLibrary">

Copy the file to the folder "C:\Program Files (x86)\Workflow Manager Tools\1.0".

Open up a command prompt and go to the folder "C:\Program Files (x86)\Workflow Manager Tools\1.0" and run the Microsoft.Workflow.TestServiceHost exe.


Note the port it is listening to in "Listening at http://Myserver:12292".

Go to Visual Studio and place a breakpoint in the workflow designer using the

  1. Open the workflow XAML in designer
  2. Click on the activity you want to debug

  3. Click on the right button in the mouse to open the context menu

  4. If you want insert a code breakpoint then insert it

  5. Set the scope URI in the code to the URL in which Microsoft.Workflow.TestServiceHost exe is listening

    var rootClient = new WorkflowManagementClient(new Uri("http://Myserver:12292"));
  6. Go to the debug menu and attach the process

  7. Select Microsoft.Workflow.TestServiceHost exe from the process list.

  8. Run the Console Program in debug mode

  9. You will see the designer breakpoint is hit

  10. You can also step into code the breakpoint


You can also look at the database table in the WFInstanceManagementDB


In case of failure in the startup of an instance due to an exception you can check the preceding highlighted tables.

SELECT TOP 1000 [InstanceCounter]
















  FROM [WFInstanceManagementDB].[dbo].[Instances]



InstanceCounter               InstanceId           SessionId             ScopeId WorkflowName WorkflowId               MonitoringParameter     ActivationInfo    WorkflowStatus WorkflowStatusDetails               InstanceCreated               LastModified      SequenceNumber             Expiration               ExecutionTime   DatabaseWriteTime

32           820EF89C-4EA4-433A-98D6-A2ABBC8BED02         149e84ef-1fb8-5b56-a85c-ad951c2f8c40_570bc95a-843d-4665-bed1-6eca3837c6d3               434A6F9A-8D93-41A5-C29D-ED69F3A9439C  DebugSample     62E4B6D5-149E-4D91-94BC-0D38CDAC47AF         NULL     NULL               SystemSuspended             An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentNullException: Value cannot be null.  Parameter name: bookmark     at System.Activities.NativeActivityContext.ResumeBookmark(Bookmark bookmark, Object value)     at CustomActivitiesSample.BookmarkActivity.Execute(NativeActivityContext context)     at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)     at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)              2013-04-17 20:53:46.650      2013-04-17 20:53:46.650              1             NULL     2013-04-17 20:53:46.980               2013-04-17 20:53:47.060


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now