How to debug SharePoint 2013 workflows by Visual Studio


Normally you can debug SharePoint 2013 workflows that developed by Visual Studio  via using F5 and putting breakpoints . In this scenario actually the debugging happens with a Service Host emulator not actual Workflow Manager host instance. In some cases the actual activities or components are not same as registered by SharePoint to Workflow Manager according to Service Host emulator. As a consequence of this , the breakpoints can not hit when execution .
http://msdn.microsoft.com/en-us/library/ee358745(v=vs.110).aspx .To fix that issue you have to be sure that your dev tools and components are same the host environment.

Workflow debugging also supports using Visual Studio’s infrastructure to attach to a process. This enables the workflow author to debug a workflow running in a different host environment such as Internet Information Services or actual Workflow Service’s Host. If your workflow manager is already setup in same box with your Visual Studio , here you can find how can you do it.

1) Open your workflow Project in Visual Studio .

2) Set the breakpoint for related activity .

AddBreakPoint

 

3) Click Visual Studio -> Tools -> Attach to Process

AttachTheProcess

4) Find and select “Microsoft.Workflow.ServiceHost.exe” in process list .

5) Click the “Select…” button for code type

SelectCodeType

6) Select “Debug these code types” as Workflow and click OK .

7) Click “Attach” Button and Attach one more time for the confirmation window.

8) After that you have to lunch/run related workflow from SharePoint Site.

9) If everything is correct , the breakpoint will get hit.

BreakPointHits

As you can see the callstack and local parameters are shown and can be debugable.

 

 

 

Advertisement

About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: