WPF Debugging in VS

If you ever debug WPF elements or use the QuickWatch feature in VS, I suggest you try out Mole. It’s a visualizer similar to Snoop, allowing you to view the visual/logical trees, as well as an extended set of properties, directly from VS.

I was particularly impressed by the number of cool features, such as being able to add “favorite” properties to debug (always annoying in VS to have to scroll) or being able to dynamically view a collection’s items in a data grid. You can also get a visual representation of the element you're debugging, as well as its Xaml. It is also reported to work with XBAPs, although I haven’t tried that.


  • For X64: Copy the assembly to %ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers
  • For X86: Copy the assembly to %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers


After setting a breakpoint near a WPF element, you should be able to highlight the object and click on the magnifying lens icon. To make this easier, you can temporarily add a PreviewMouseLeftButtonDown event to your top-most window and Ctrl-Click an item.

You can find videos and more documentation here.



Comments (2)

  1. Dan Lamping says:

    Here’s a useful technique for debugging/tracing triggers effectively. It allows you to log all trigger actions along with the element being acted upon:

    <a href="http://www.wpfmentor.com/2009/01/how-to-debug-triggers-using-trigger.html">http://www.wpfmentor.com/2009/01/how-to-debug-triggers-using-trigger.html</a&gt;

Skip to main content