Using the Locals Window
The Locals window displays variables local to the current context.
To display the Locals window
- From the Debug menu, choose Windows and click Locals. (The debugger must be running or in break mode.)
The default context is the function containing the current execution location. You can choose an alternate context to display in the Locals window.
To choose an alternative context
- Use the Debug Location toolbar to select the desired function, thread, or program.
- Double click on an item in the Call Stack or Threads window.
To view or modify information in the Locals window, the debugger must be in break mode. If you choose Continue, some information may appear in the Locals window while your program executes, but it will not be current until the next time your program breaks (in other words, it hits a breakpoint or you choose Break All from the Debug menu).
To modify the value of a variable in the Locals window
- The debugger must be in break mode.
- In the Locals window, select the value you want to edit by double-clicking on it or by using the TAB key.
- Type the new value, and press ENTER.
Caution Editing floating-point values can result in minor inaccuracies because of decimal-to-binary conversion of fractional components. Even a seemingly innocuous edit can result in changes to some of the least significant bits in the floating-point variable.
You can set the numeric format used in the debugger windows to decimal or hexadecimal. For more information, see Changing the Numeric Format of Source Windows.
Note (Visual C# only) When an uncaught exception occurs, a pseudovariable
$exceptionis added to the Locals window. You can expand this pseudovariable to see information on the exception.