Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Creating Debugger Visualizers with Visual Studio 2005

With debugger visualizers, you can define the information you would like to see about a specific .NET or custom class during debug mode. And as the name suggests, you can also choose how you would like to visualize these details.




Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

ne of the many cool new features in Visual Studio 2005 is the debugger visualizer. Debug info is no longer limited to what comes in the box with Visual Studio .NET. Visual Studio 2005's new debugger visualizers enable you to inspect classes in more useful and complex ways. You can write your own visualizer for .NET classes or custom classes to see the information that you find useful while debugging. In addition, Microsoft has written a handful of helpful visualizers to get you started. Visual Studio 2005 has some pre-existing visualizers that you will discover during debug mode. You can access the visualizers by using a dropdown list on the left side of the new DataTips between the selection and its value. (Note that prior to the November Community Technical Preview (aka CTP), the dropdown was on the right. You will find the new position much more convenient.) For example, if you point to a string object in Debug mode as in Figure 1, or even an actual string as in Figure 2, you will have access to three debugger visualizers: Text, XML, or HTML.

You can also access visualizers through the Watch windows. Figure 3 shows the DataTip's Watch window where you can see the _stringvalue property of a StringBuilder object. When you select the XML visualizer, you will get a better view of the XML-formatted string, demonstrated in Figure 4.

Figure 1. Access Visualizers from Datatips: You can access debugger visualizers from a drop down in the datatips. Here is a debugger visualizer for an object.
Figure 2. These visualizers are also available for raw string data in your code.
Another handy visualizer that Microsoft has already written and included with the Beta1 version of Visual Studio 2005 is for DataTables and for DataSets. Something that surely many developers have considered—this visualizer presents a quick way to see the contents of a DataTable. Though they are named "DataSet visualizer" and "DataTable visualizer," they present the same UI. These two visualizers are read-only. The screenshots in a DataSet visualizer in Figure 5 and Figure 6 show how you can select the various DataTables within a DataSet to view.

Figure 3. Debugger visualizers are also available in the watch windows as seen with this m_stringValue property of a StringBuilder object.
Figure 4. An XML visualizer displays XML in a format that is perfectly readable.
Look for more "out-of-the-box" visualizers in future releases of Visual Studio 2005.

Figure 5. Microsoft has also provided pre-written visualizers for DataSets and DataTables.
Figure 6. The DataSet and DataTable visualizer shows a grid view of the actual data. You can access all DataTables in a DataSet through the DataSet visualizer's interface.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date