次の方法で共有


Changing Context in the Locals Window

Keyboard:  CTRL + ALT + V, L; CTRL + 5; CTRL + 6; CTRL + 7

Menu: Debug -> Windows -> Locals
Command:  Debug.Locals; Debug.LocationToolbar.ProcessCombo; Debug.LocationToolbar.ThreadCombo; Debug.LocationToolbar.StackFrameCombo
Versions:  2008,2010
Published:  10/5/2010
Code:  vstipTool0101

 

Most people are familiar with the Locals window.  For those that aren't, it displays variables local to the current context or scope.  Information often appears in the Locals window, but the information will not be current until the next time the program breaks.

 

 

Even those that are familiar with the Locals window may not know that you can change the context for it.  When you are in break mode you will see the the locals window:

image

 

 

Debug Location Toolbar

You can use the Debug Location toolbar to change the context of the locals window.  If you don't have it up you can RIGHT CLICK any toolbar and select it to make it appear:

image

 

 

Process

If you have multiple processes running you can use the Process combo to change between them.  In this example, I only have one process running.

image

 

 

Thread

The Thread combo lets you change the thread context different threads.  While not of much use in this example, it is very useful in debugging multi-threaded applications:

image

 

 

Stack Frame

Probably the more common item you will use when dealing with the Locals window.  The Stack Frame combo allows you to switch between items in the call stack:

image

 

Currently I'm in the one method and the Locals window shows this:

image

 

 

If I change to another method in my code:

image

 

 

Now my Locals window shows this:

image

 

And there you go!  Now you, too, can take advantage of the Debug Location toolbar to change your context and get new information in the Locals window.

Comments

  • Anonymous
    March 14, 2012
    The comment has been removed
  • Anonymous
    March 14, 2012
    The comment has been removed