Freigeben über


How to: View Contents of Variables

You can use the Microsoft Visual Studio 2008 debugger to view and modify the contents of certain variables at run time. After the debugger pauses the extension at a breakpoint, you can view the contents of a variable in any of the following ways.

To view the contents of variables

  1. Select the variable in the code window.

  2. Do one of the following:

    • Rest the pointer over the variable.

      Visual Studio 2008 usually displays the contents of the variable in a tooltip.

    • Right-click the variable, and click Quick Watch.

      Visual Studio 2008 usually displays the contents of the variable in the QuickWatch window.

    • Click Debug, and then click Quick Watch.

      Visual Studio 2008 usually displays the contents of the variable in the QuickWatch window.

    • Right-click the variable, and click Add Watch.

      If possible, Visual Studio 2008 displays the contents of the variable in one of the Watch windows. The individual Watch windows can be displayed or hidden by clicking Debug, then Windows, then Watch, and then the desired Watch window.

When the debugger pauses the extension at a breakpoint, you can modify the contents of a variable while the code is running by viewing the variable in either the QuickWatch or Watch windows and then clicking the Value of the variable. You can then enter the value that you want for the variable.

Warning

Exercise extreme caution when you change variable values because it is very easy to enter an invalid value for the variable. This can cause the code to throw an exception and possibly become unstable.

For more information about the debugger and its features, see Using the Visual Studio .Net Debugger in the Visual Studio 2008 documentation.

See Also

Concepts

Testing and Debugging Rules Extensions
Creating Rules Extensions
Rules Extensions Examples
How to: Attach the Visual Studio Debugger to the Process