Visualizers: New Debugging Tools That Display Data


Visualizers: New Debugging Tools That Display Data

Although you can use the Watch, Autos, and Locals windows to examine simple data types such as Integer and String in the IDE, you'll eventually be faced with more complex data in your programs. For example, you might be examining a variable or property containing structured information from a database (a dataset) or a string containing HTML or XML formatting information from a Web page. So that you can examine this type of item more closely in a debugging session, Visual Studio 2005 has added a new set of tools to the IDE called visualizers (small magnifying glasses).

The Visual Studio 2005 IDE offers four standard visualizers: the text, HTML, and XML visualizers (which work on string objects), and the dataset visualizer (which works for DataSet, DataView, and DataTable objects). Microsoft has implied that it will offer additional visualizers as downloads at some point in the future, and they have designed Visual Studio so that third-party developers can write their own visualizers and install them into the Visual Studio debugger. In the following exercise, you'll see how the text visualizer works. (For this exercise, I assume that you are still in debugging mode and that the Watch window is open with a few expressions in it from the Debug Test program.)

Open a text visualizer in the debugger

  1. Look on the right side of the Watch window for a small magnifying glass icon.

    A magnifying glass icon indicates that a visualizer is available for the variable or property that you are examining in a Watch window, an Autos window, or a Locals window. If you completed the previous exercise, the TextBox2.Text property shows a visualizer now.

  2. Click the visualizer arrow.

    When the property you are examining is a text (string) property, Visual Studio offers three visualizers: a simple text visualizer that displays the selected string expression as readable text, an HTML visualizer that converts HTML code to a Web page, and an XML visualizer that converts XML code to a viewable document. Your screen looks like the graphic shown below.

    graphic

  3. Click the Text Visualizer option.

    Visual Studio opens a dialog box and displays the contents of the TextBox2.Text property. Your screen looks like this:

    graphic

    Although this particular result offers little more than the Watch window did, the benefits of the visualizer tool become immediately obvious when the Text property of a multiline textbox object is displayed, or when you examine variables or properties containing database information or Web documents. You'll experiment with these more sophisticated data types later in the book.

  4. Click Close to close the Text Visualizer dialog box.

Leave Visual Studio running in debugging mode. You'll continue using the Watch window in the next section, too.

TIP
In debugging mode, visualizers also appear within pop-up windows called DataTips in the Code Editor. When you point to a variable or property within the Code Editor during a debugging session, a DataTip appears, and you can click the visualizer icon for more information as you did in the previous exercise.



Microsoft Visual Basic 2005 Step by Step
Microsoft Visual Basic 2005 Step by Step (Step by Step (Microsoft))
ISBN: B003E7EV06
EAN: N/A
Year: 2003
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net