Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Debugger Roadmap
Visualizers
 How to: Test and Debug a Visualizer
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Debugger
How to: Test and Debug a Visualizer

Updated: November 2007

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic appliesTopic applies

Managed only

Topic applies

Standard

Topic appliesTopic applies

Managed only

Topic applies

Pro and Team

Topic appliesTopic applies

Managed only

Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

Once you have written a Visualizer, you need to debug and test it.

One way to test a visualizer is by installing it in Visual Studio and calling it from a debugger window. (See How to: Install a Visualizer.) If you do that, you will need to use a second instance of Visual Studio to attach and debug the visualizer, which is running in the first instance of the debugger.

An easier way to debug a visualizer is to run the visualizer from a test driver. The visualizer APIs make it easy to create such a driver, which is called the visualizer development host.

To create a visualizer development host

  1. In your debugger-side class, include a static method that creates a VisualizerDevelopmentHost object and calls its show method:

    public static void TestShowVisualizer(object objectToVisualize)
    {
       VisualizerDevelopmentHost myHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(DebuggerSide));
       myHost.ShowVisualizer();
    }

    The parameters used to construct the host are the data object that will be shown in the visualizer (objectToVisualize) and the type of the debugger side class.

  2. Add the following statement to call TestShowVisualizer. If you created your visualizer in a class library, you need to create an executable to call the class library and place this statement in your executable:

    DebuggerSide.TestShowVisualizer(myString);

    For a more complete example, see Walkthrough: Writing a Visualizer in C#.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker