Debug Visualizers

Beginning with Visual Studio .NET 2005, the IDE has the ability to load custom forms when you hover over an item while debugging.  These are called Debug Visualizers.  Visual Studio comes with a couple of basic ones.  But the cool thing is that you can write your own - and of course there have been a few really great ones released on the internet!

The first one I'll discuss here is the Conchango Xml Visualizer.  As you might guess, this one lets you "visualize" an XML document while debugging.  So, let's get started with a sample XML document:

And this simple code to load it in:

Now, let's step into this method, and click on the magnifying glass to see the Cochango Xml Visualizer at work:

Just in case that's hard to see:

And here is what you get:

You can double-click on a node to open/close it:

There are "right-click" options as well:

And here's the output of the "View Node Xml" option:

Next, I'd like to present the Visual Studio 2005 Control Visualizer.  While it's not the most original name you could hope for, it does have a very nice feature.  This one lets you visualize the HTML output that will be rendered by a webcontrol.  

Here is some sample code that builds up a Table control:

And here is what you get from the visualizer:

Nuff Said!

Of course, there are many others available on the internet, and of course you can write your own!  Here are some links to pursue if you're interested:

1) A visualizer that displays a string in various encodings.

2) A visualizer that displays the control tree (child controls).

3) A visualizer for working with RegEx.

4) A visualizer for images.

5) A visualizer for the GUI (including WPF).

6) David Hayden's article about creating your own visualizer.

7) Julia Lerman's article about creating your own visualizer.

8) Nonnenberg's article about creating your own visualizer.

9) 4GuysFromRolla article about creating your own visualizer.

10) Philly.NET's own Steve Andrews has great links, downloads, and information here about creating your own visualizers.