This documentation is archived and is not being maintained.

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

  1. The debugger must be in break mode.
  2. In the Locals window, select the value you want to edit by double-clicking on it or by using the TAB key.
  3. 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 $exception is added to the Locals window. You can expand this pseudovariable to see information on the exception.

See Also

Locals Window | Breaking Execution | Viewing and Modifying Data | Using the This Window | Using the Autos Window | Visual Studio Debugger Model