Debugging Guidance Packages

In the last couple of weeks a couple of people have pinged me to ask about how to best test and debug guidance packages built with the Guidance Automation Toolkit. Two questions on the same topic in a month is my threshold for creating a blog post (it's one way to manage the constant deluge :-), so here you go:

It is true that authoring, customizing and testing guidance packages were not at the top of our priority list when we created GAT/GAX. While we know these scenarios are important, our thinking was that unless we delivered a runtime that was flexible enough to support rich and easy to use guidance packages, nobody would want to author them to begin with - so we initially optimized more around the user experience than the authoring or customization experience. However the excitement and momentum around our first set of Software Factories shows that we have hopefully succeeded in our initial goals, so improving the authoring experience is a top priority for the next release of our guidance automation infrastructure. We are working on this now, so if you have any suggestions around what you would like to see, please let me know.

But even with the limitations of the current solution, debugging a guidance package isn't actually that difficult - although it isn't necessarily obvious how to set it all up.

The secret is to use one instance of Visual Studio for editing your guidance package, and another to test it. In your guidance package solution, you can configure the project properties to launch devenv.exe (i.e. Visual Studio) when you debug the solution by hitting F5. I find it helpful to always use a specific test solution for debugging - this can be any set of projects which are helpful for testing the functionality in the guidance package. You can set the path to your test solution as a command line parameter when debugging, as shown in the screenshot below:

Once you've set this up, the only other thing you need to remember is to register the guidance package (using either the Register or Quick Register recipe provided by GAT) from the guidance package's solution before you start debugging. Then all you need to do is hit F5, and another instance of Visual Studio will launch with your test solution loaded. When your guidance package is enabled in this solution, you can use all of the standard debugging features, like breakpoints, the watch window and all the rest to make sure it works as intended.