Saturday, November 24, 2007 10:30 PM
It's
Thanksgiving here in the states, which means it's time to acknowledge those things we're thankful for. In keeping with the tradition, here are some things that I'm thankful for: friends and family, my pet goldfish Unagi, and custom debugger visualizers.
What's that last one? Debugger visualizers are a feature of Visual Studio which allow you to design and assign your own visualization helpers to different data types so that you may examine them while debugging directly inside of Visual Studio. The text, XML, and HTML visualizers that you've probably seen whenever you right-click on a string object while debugging are great examples of the standard ones that ship with studio. Custom debugger visualizers allow you to easily write your own visualizers for not only standard .NET datatypes, but for your own custom datatypes as well.
Around a year ago, I was doing a lot of work with custom printing and reporting. In order to simplify the process I wrote customer visualizers both for images and for text. Although I haven't used either of these visualizers in over a year, I happened upon the code this past week and I thought I would release it to the community in the spirit of open source.
The image visualizer allows you to see the image exactly as it exists in memory as well as the values of certain attributes of the image.
The text visualizer displays text exactly as you would expect, however, it marks the whitespace it finds with the words WHITE_SPACE. As I mentioned before, these visualizers were written to aide in development of custom reports which is why being able to determine exactly how many whitespace characters existed between certain words was so important (think tabs).
If you examine the code, you may also notice a GDI+ custom debugger visualizer as well. This was a canvas visualizer, very similar to the image visualizer, designed to display the current contents of a GDI+ canvas. However, I ran into a small issue which prevented my finishing this visualizer related to serialization of GDI+ objects. There is a work around available, however, I completed the project before I needed to finish the visualizer. If there is sufficient interest in this particular visualizer leave me a note in the comments and I'll likely go back and finish it.
To install the visualizers, simply copy the DLL below into the following directory on your machine:
<My Documents>/Visual Studio 2005/Visualizers and restart Visual Studio. The visualizers will then be available in the drop down menu whenever you hover over a compatible datatype.
If you're so inclined, you can find the source code for all three visualizers
here or you can simply download the resulting DLL to install to Visual Studio
here. Note that while these visualizers work fine in 2005, they do not appear to work in 2008. Once again, however, if there is a significant demand for 2008 support in the near term then let me know and we'll see what we can do.