The debugger provides a number of variable windows for displaying, evaluating, and editing variables and expressions. Each variable window includes a grid with three columns: Name, Value, and Type. The Name column contains variable names or expressions. The Value and Type column display the value and data type of the variable or expression.
The type of information displayed in the grid depends on which variable window you are using:
The Locals window displays variables local to the current context or scope. Usually, this means the procedure or function you are currently executing. The debugger populates this window automatically. In Visual C#, when the Exception Assistant is disabled, the Locals window also displays a pseudovariable $exception whenever there is an active exception. You can expand the pseudovariable to see details of the exception.
The Autos window displays variables used in the current line of code and the preceding line of code. For native C++, the Autos window displays function return values as well. Like the Locals window, the Autos window is populated automatically by the debugger.
The Watch window is where you can add variables whose value you want to watch. You can add more than just variables, however. You can add any valid expression recognized by the debugger. (For valid expression syntax, see Expressions in the Debugger). Some editions of Visual Studio have multiple Watch windows, which are numbered Watch1 through Watch4.
The QuickWatch dialog box is similar in concept to the Watch window, but QuickWatch can display only one variable or expression at a time. QuickWatch can be useful when you want to take a quick look at a variable or expression without bringing up the Watch window. However, many users find the new enhanced DataTips so powerful that they use QuickWatch much less often. (See View data values in Data Tips in the code editor.)
Even though QuickWatch is a dialog box, it functions much like the other variable windows. Except where otherwise noted, the procedures described in this section apply to the QuickWatch dialog box as well as other variable windows.