RSS
 

Debugging Team Foundation Server 2010 Build Workflow

23 May

Lately, I had some time to spend on developing Workflows with the Windows Workflow Foundation v4.0. I need to make some modifications to our build workflow template.

Howto Debug Team Foundation 2010 Workflow

There is an excellent post on how to debug TFS 2010 Workflows:
http://blogs.microsoft.co.il/blogs/baruchf/archive/2009/07/02/debugging-team-build-now-you-can.aspx

Problem…

I had the following problem after performing the steps from his blog:
When your xaml workflow file has been created on a different machine, the path to debug will not work.

You can see this in the output (Debug) window of your visual studio after attaching to process (“TFSBuildServiceHost.exe”).

‘TFSBuildServiceHost.exe’ (Managed (v4.0.30319)): Loaded ‘Workflow’
Instrumentation for debugger fails. Reason: Could not find file ‘C:\tfs\project\build\myBuildTemplate.xaml’..’TFSBuildServiceHost.exe’ (Managed (v4.0.30319)): Loaded ‘Workflow’

You will notice the following breakpoints will never be hit:

Solution

Edit your Template XAML file in a text editor and change the following filename value.


    
    
 

Make sure you check-in your workflow template and your breakpoints will be hit:

Caveat?

However, there is a caveat when debugging the “Run On Agent” Activity. I haven’t found a way to debug the activity itself. Breakpoints outside the activity will be hit, breakpoints inside it will just be skipped. The same problem for scoped variables. Variables that are defined inside the Run On Agent activity are null when you use them outside the activity. Weird behaviour but I ended with moving my logic inside the Run On Agent after it was debugged properly with static variables.

 

Leave a Reply