Viewing Local Variables in the Locals Window

The Locals window displays the values and types of all variables that are within the scope of the currently executing procedure. This window allows you to learn about the lifetime of a variable as you step through your application because you can see when it is initialized, when it changes, and when it is destroyed. When a variable comes into scope it will be shown in the window. It remains visible as long as it is in scope, reflecting any changes to its value. When the variable goes out of scope it is removed from the Locals window.

With languages that support multiple threads of execution, you can view the local variables for a particular thread by selecting it from the threads list.

To view the Locals window

  • Choose Locals from the Debug Windows submenu, available from the View menu.