Debugging a K2 workflow

Debugging a K2 workflow at runtime is much like debugging other server-based applications since it requires attaching to the K2 blackpearl Server application. Once attached to the server application you can set breakpoints, add watches, and perform any other typical debugging functions.

Considerations

The K2 blackpearl Server will halt all processing when a breakpoint is active. Therefore, debugging should be performed only on development or test machines. Production servers should only be debugged when absolutely necessary.

Step By Step: Debugging a workflow

The steps below assume you are working on a development machine where Visual Studio and the K2 blackpearl Server are both installed locally.

  1. Design a process and deploy it. 
  2. Right-click the activity you want to debug and then click View Code > Event Item.
  3. If the Workflow Foundation designer appears, right-click one of the items and then click View Code.

  4. Scroll to an area of interest in the code and set a breakpoint.
  5. On the Debug menu in Visual Studio click Attach to Process.
  6. Click the Show processes from all users option.
  7. Scroll through the Available Processes list and select K2HostServer.exe.
  8. Click the Select button in the Attach to option.
  9. In the Select Code Type dialog box, click Debug these code types and then put a check mark next to Managed.
  10. Click OK.

    The Attach to Process dialog box should resemble the following figure

  11. Click Attach
  12. On the Attach Security Warning dialog click Attach.
  13. Start an instance of the process or action the process, depending on your process and the stage at which you are debugging.
  14. When the breakpoint is hit the Visual Studio window should become active and you will see the breakpoint highlighted as in the following figure.

K2 blackpearl Developers Reference4.7
Video Links Learn Support
No videos found for this article
K2 on YouTube
No Additional links found for this article
No self-learning content for this article
Try some scenarios...
No relevant support links available for this article