Archive for the ‘WF’ Category

A Debug Activity for Workflow Foundation

October 1st, 2008

After having worked mostly conceptually for a few months (a detour to enterprise messaging), I’m back to writing code and getting my hands dirty. And I finally managed to get the time to start playing with Windows Workflow 😀

To me, learning is all about playing around with the technology, and here’s a first result that I think might be useful for you, too. This WF activity allows you to display an optionally parameterized message via console, debug window, or an assertion:

  • Console: The message is displayed via Console.WriteLine()
  • Debug: The message is displayed via Debug.WriteLine()
  • Assert: The message is displayed via Debug.Assert()


The activity supports binding points for up to 5 parameters and an optional Condition property to suppress output through either declarative or code conditions. The currently selected output mode  is nicely reflected by the designer.

 Debug Activities

Basically, the activity enables you to quickly include debugging tasks into your workflow without leaving the designer. Below is a screenshot of the console output in the ifNegativeActivity branch:

Activity Properties

At runtime, this causes the following output on the console:



The library comes with the above sample, and pretty much demonstrates the different features. The only thing worth mentioning is the use of Conditions:

  • In case of Console or Debug output mode, a condition is not required. However, in case a condition was defined, the output message will only be displayed if the condition evaluates to true. Otherwise, the activity skips the output.
  • In case of Assert output mode, the Condition property is mandatory (validated by the designer). Furthermore, in compliance with Debug.Assert, the output message will only be displayed if the condition evaluates to false.


The activity itself is pretty simple, but it makes a nice addition to my toolbox, especially while I’m learning. Enjoy 🙂

Important: Once you opened the sample, you will have to restart VS2008 after the initial build, or the designer won’t work properly (apparently an issue with the IDE’s cache)!

Download (VS2008):

Author: Categories: Open Source, WF Tags: ,