
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Looking at Exceptions in a New Way Using Visualizers
|
427
The other important part of setting up the visualizer infrastructure is that the class
library needs to display the
System.Diagnostics.DebuggerVisualizerAttribute for
each object type it is going to support. To support
System.Exception, the following
attribute is necessary:
[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(ExceptionalVisualizer.ExceptionVisualizer),
typeof(VisualizerObjectSource),
Target = typeof(System.Exception),
Description = "Exception Visualizer")]
The DebuggerVisualizerAttribute can have the properties listed in Table 7-3.
Once the Visualizer is built, it needs to be deployed to one or both of the following
locations:
• Visual Studio Install Directory>\Common7\Packages\Debugger\Visualizers (for all
users)
• My Documents>\Visual Studio\Visualizers (for the current user)
This is where Visual Studio 2005 looks for the visualizers on debugging startup so
that they can be loaded into the processes. The visualizer is accessed through a
magnifying glass icon when the mouse hovers over an exception object in the
debugger, as shown in Figure 7-9. Select the down arrow and choose the type of visu-
alizer to use. These type names are taken from the
Description property of the
DebuggerVisualizerAttribute.
Discussion
There ...