News
Photos
Articles
Components
Applications
Kleinkunst

.NET - Mole Visualizer for Visual Studio

Last week Josh Smith, Karl Shifflett & Andrew Smith released version 4 of their open-source Mole Visualizer for Visual Studio 2008. Visualizers are Visual Studio plugins which allow developers to view objects and data using a specialized user interface while debugging. There are a lot of great visualizers available for LINQ, XML, Datasets, ... but Mole is definitely one that every Visual Studio developer should have installed.

Originally Mole only targeted WPF applications, but version 4 can also be used for WinForms and WCF applications. Mole shows a visual and logic tree of the user interface of a WPF Window or WinForms Form. Mole does not only allow you to view objects and data, it also allows you to drill into properties and child objects. A lot of properties can be modified and the result is displayed in a live preview. Collections (IEnumerable) are shown in grids and Mole has a lot of specialized property editors (dates, colors, fonts, ...).

How to install and use it ?

1) Download the Mole Visualizer assembly from the CodeProject website.

2) Copy Mole.Visualizer.dll to your personal Visual Studio 2008\Visualizers folder.

3) Restart Visual Studio.

4) While debugging, hover a WPF object and click on the magnify icon.

Some screenshots say more than 1000 words, so here are 2 screenshots of one of my WPF applications :

Mole can also be used in WinForms applications. The visualizer can only be evoked from a WinForm Form, not from individual controls. So go to the Autos or Locals debugging window and click on the magnify icon of this (or Me in VB.NET).

 

Update 22/01/2008 : Version 4.2 supports the Workflow Foundation and it introduces a great hack. By wrapping an object into a System.WeakReference object a generic way has been found to visualize every object in Mole. So now Mole can also be used in Console applications, Office addins, ... Just add a watch and wrap your object into a WeakReference object.

 

Mole is really a great visualizer, not only for debugging but also for learning WPF. Every Visual Studio developer should install and use it.

For more information