How to Debug a workflow with Visual Studio

How to Debug a workflow with
Visual Studio

As the workflow
published on SharePoint run under the IIS process, it is possible to debug via
Visual Studio by attaching the IIS process.

On the Debug menu,
select “Attach to Process…”

 

Tips: If you have many “w3wp.exe” processes running at the same time, to
determine which process you have to debug, you can use this script that gives
you some information about the process that can help you.

Under a Dos prompt,
type “c:\windows\system32\iisapp.vbs”.

For instance, if your workflow run under port 80, then
chose to attach process id=3716.

Attention: Another point to be careful is sometimes, when attaching a process to
debug a workflow; your Visual Studio may crash. If this happen, make sure to
manually select the code type to “Workflow

Remark: If your workflow contains a delay activity, you will have to attach the owstimer to debug it once the owstimer rehydrate the Workflow instance.