Compartilhar via


How to: Debug Your SharePoint Foundation Workflow

Applies to: SharePoint Foundation 2010

After you deploy and activate your workflow Feature, you can debug the workflow by opening your workflow project and attaching to the w3wp process.

Because the Visual Studio 2010 Workflow Designer is hosted within Microsoft Visual Studio 2005, you can take advantage of the Visual Studio debugging capabilities. You can set breakpoints in the code in your code-beside file.

Note

For ease of debugging, we strongly recommend that you develop your workflow templates on a server running Windows SharePoint Services 3.0.

The Visual Studio 2010 Workflow Designer supports not only standard Visual Studio debugging features such as breakpoints and call stack windows, it also includes a range of visual indicators that provide information during the debugging process.

You can perform step in, step out, and step over operations to move through workflow code.

Note

The following types of debugging are not supported by the Visual Studio 2010 Workflow Designer: just-in-time debugging of run-time exceptions in the hosting process, and just-in-time debugging by selecting a process in the Task Manager.

For more information about debugging using the Visual Studio 2010 Workflow Designer, see the Windows Workflow Foundation SDK.

Note

The Windows Workflow Foundation SDK is available as part of the download titled Visual Studio 2005 Extensions for Windows Workflow Foundation available on the Microsoft Download Center. This download also contains the Visual Studio 2010 Workflow Designer, as well as the Windows Workflow Foundation runtime engine.

To attach to the Windows SharePoint Services process to debug a workflow

  1. Install your workflow Feature.

    If you have previously installed your workflow Feature, but you have changed your workflow’s Feature manifest .xml files, uninstall and reinstall the Feature using stsadm.

    For more information about installing Features, see Using Features in SharePoint Foundation.

    Note

    Uninstalling the workflow Feature disables any existing workflow associations for that workflow template. To re-enable a workflow association in a list or content type, on the list or content type Settings page, select Workflow Settings, and then select Remove a workflow. Select the Allow button for the workflow association you want to re-enable.

  2. Install the workflow assembly in the global assembly cache.

  3. Reset Microsoft Internet Information Services (IIS) so that changes can take effect. To do so, open a command line window and type iisreset at the command prompt.

  4. In Visual Studio 2005, attach to the w3wp processes:

    1. On the Tools menu, select Attach to Process.

      Make sure that Attach to: is set to Workflow code. If necessary, click Select; in the Select Code Type dialog box, select Workflow, and then click OK.

    2. Select the w3wp processes, and then click Attach.

      Note

      If the w3wp process is not running, open any SharePoint Foundation page to activate the process.

  5. Add a breakpoint in your workflow, for example, in the OnWorkflowActivated activity that initiates your workflow.

  6. In the SharePoint Foundation user interface, initiate your workflow.

    When your assembly loads, the breakpoints are activated, and the debugger halts code execution at the breakpoints in your workflow.

See Also

Other Resources

Workflow Development in Visual Studio