18 April 2006

A GUID Debugger Visualizer for Visual Studio 2005

For those of you working in Visual Basic 2005, have you ever had a situation where you would like to view the value of a GUID variable during a debugging session?

One of the nice additions to Visual Studio 2005 are debugger visualizers. During a debugging session you can just hover over a variable to view the contents of that variable. This works for almost all .NET data types. However, if you try it with a GUID value, you can't see the actual value - rather you see "{System.Guid}" or "Empty", if you expand the visualizer.

I got tired of constantly typing "? guidVariable.ToString" in the Immediate window so I decided to create a GUID debugger visualizer. This visualizer allows you to view the actual value of the GUID variable, reset the value (either to an empty GUID or a GUID value of your choice), or generate a new GUID value. During a debugging session, simply click on the small magnifying glass while hovering over a GUID variable to display the visualizer (see image below).

Although I initially built this visualizer for Visual Basic 2005 (it's actually written in C#), it can be used for C# code as well. C#, oddly enough, has a built-in visualizer for GUIDs. However, my visualizer has some extra-added benefits (e.g. resetting to an empty GUID and generating a new GUID).

The installation package is available here: http://www.moonspace.net/blog/gv/GuidVisualizerSetup.msi

Please post with any suggestions.