Out of the box there are four standard visualizers :
- Text Visualizer
- HTML Visualizer
- XML Visualizer
- Dataset Visualizer
Visualizers are represented in the debugger by a magnifying glass icon. When you see the magnifying glass icon, you can click on it to select a visualizer appropriate to the data type of the corresponding object.
I included a preview of the HTML Visualizer ...
At TechEd 2005 in Amsterdam, I attended the session What's new in the Visual C# 2005 IDE, given by Juval Lowy. I remembered that he showed us a custom sound visualizer and I was pretty impressed how easy it was to create one on your own for a custom class. So I tried it out tonight ...
I created a class Player with some properties (FirstName, LastName, Image, ...) and for that class I wanted to create a custom Visualizer : PlayerVisualizer (see example below). The custom form (visualizer) displays an image of the player and some other player-information.
While debugging I'm now able to see a custom view of the Player object. No more playing around in the command/immediate window to query for the info you're looking for. Just clicking the magnifying glass to call the custom visualizer. Cool, isn't it?
All I had to do was :
- Adding a Debugger Visualizer Template to my project
- Creating a custom form to display the info I wanted and how I wanted it.
- Adapting the template (Show-method)
- casting to a Player object
- passing Player object to custom form
- show custom form
- Adding the DebuggerVisualizerAttribute to tell the debugger about the classes that make up the visualizer