Debugging Visual Studio 2005 workflows for SharePoint
© 2008-2010 DocumentManagementWorkflowInfo.com - Read our Copyright Notice
Learn which steps are required to be able to set up and debug Visual Studio 2005 workflows for SharePoint.
If you’re developing a SharePoint workflow in Visual Studio 2005 on the same machine where SharePoint is running, debugging the workflow is a 5-step process:
- Deploy your workflow to SharePoint.
- Set breakpoints in your workflow code.
- Set the Visual Studio debugger to attach to Workflow code.
- Attach the Visual Studio debugger to the w3wp.exe process for the SharePoint server to which the workflow has been deployed.
- Perform actions in SharePoint to run the workflow and have the code break in the debugger.
Set the Visual Studio debugger to attach to Workflow code
To set the Visual Studio debugger to attach to Workflow code:
- In Visual Studio 2005, on the Debug menu, click Attach to Process.
- On the Attach to Process dialog box, click Select behind the Attach to text box.
- On the Select Code Type dialog box, select Workflow in the Debug these code types list box, and click OK.

Figure 1. Attach to Workflow code to debug a SharePoint workflow in Visual Studio.
Attach to the w3wp.exe process for SharePoint
While you could attach the Visual Studio debugger to all of the w3wp.exe processes listed in the Available Processes list box on the Attach to Process dialog box, if you want to attach the debugger to only one process, you could use the following method to find the right process to attach to:
- Open a command-line window.
- Navigate to the c:\windows\system32 directory.
- Type iisapp.vbs and press [Enter].
A list of application pool names and process IDs will be displayed. You can then choose the process ID that corresponds to SharePoint and then in Visual Studio, attach the debugger to this process ID.

Figure 2. Finding the process ID for the worker process of the SharePoint application pool.
Debug the SharePoint workflow in Visual Studio
Once you’ve selected the correct process ID for the worker process of the SharePoint application pool from the Available Processes list box on the Attach to Process dialog box, you can click Attach to start the debugging session.
And once you’ve started the debugging session, you must go to SharePoint and perform actions that will cause your workflow to run.
Your workflow should hit the breakpoints you’ve set previously and break in the debugger in Visual Studio. If your breakpoints are not being hit, double-check whether you’ve correctly deployed the DLL for your workflow to the GAC. This includes checking for any typing errors in the values for the CodeBesideClass and CodeBesideAssembly attributes in the workflow.xml file.
Related Articles
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of the owner of DocumentManagementWorkflowInfo.com. The techniques demonstrated in this article may be used within any SharePoint project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the owner of DocumentManagementWorkflowInfo.com.
