flow.
"Flow is a condition of deep, nearly meditative involvement." - Tom DeMarco

Custom Debugger Visualizers

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.

kick it on DotNetKicks.com

Feedback

 re: Custom Debugger Visualizers

These look like they will come in very handy, thanks. On a different subject, is there any chance of getting my hands on the settings for your colour theme?

Cheers,

C 11/29/2007 5:07 AM | Carl

# re: Custom Debugger Visualizers

I'd be more than happy to provide you with my colors, watch for an email from me containing the settings file.

If anyone else is interested in the color settings just leave me a comment and I'd be more than happy to post them to blog.

Thanks!
Jeremy 11/29/2007 11:36 AM | Jeremy

# re: Custom Debugger Visualizers

Hi Jeremy

Please send me the settings as well.

Thank! 12/24/2007 2:44 AM | Nullable

# re: Custom Debugger Visualizers

I'm really interested in the Graphics visualizer. Do you think you can develop it or you can give me a hint how to do it? I tried to develop a visualizer for GraphicsPath but I hit the same serialization problem and I did not know how to fix it.

Thanks,
Adrian 2/18/2008 9:14 AM | Adrian Marin

 re: Graphics visualizer

Hi Jeremy,

thanks for the inspiration.
I posted my readonly solution here:

http://www.codeproject.com/KB/macros/GraphicDebuggerVisualizer.aspx

Cheers
OrlandoCurioso 3/10/2008 5:49 AM | OrlandoCurioso

 re: Graphics visualizer

Hi Jeremy,

thanks for the inspiration.
I posted my readonly solution here:

http://www.codeproject.com/KB/macros/GraphicDebuggerVisualizer.aspx

Cheers
OrlandoCurioso 3/10/2008 5:49 AM | OrlandoCurioso

Post a comment





 

Please add 6 and 8 and type the answer here: