共用方式為


Did you know... What's the difference between the Autos window and the Locals window? - #316

I’ve always wondered this, but finally took the time to ask Dustin Campbell when I met with him last week for Debugger tips.

The autos window shows the current statement and the previous statement.   it was always the previous statement that threw me off, as i never took the time to look closely enough to realize that’s where that variable was coming from.

The locals window shows everything currently in scope. Thus, the autos window is a subset of the locals window.

For example, consider the following code snippet that does nothing but produce warnings for unused variables:

Code snippet showing some variables

In the Auto windows, you’ll see the previous statement and the current statement being evaluated:

Auto windows showing previous and next statements

In the Locals window, you’ll see the everything in scope, including the args parameter:

Locals window showing everything in scope

Technorati Tags: VS2005Tip,VS2008Tip

Comments

  • Anonymous
    September 18, 2008
    > the autos window is a subset of the locals window. the autos is not limites to locals, right? Doesn't it display everything in the current (and previous) statement, not only the local variables. Cheers,

  • Anonymous
    September 18, 2008
    Did you by chance ask him where the "this" window went?  I've been unable to find it in VS2005.

  • Anonymous
    September 18, 2008
    The comment has been removed

  • Anonymous
    September 18, 2008
    The Autos window does not work like that for VB - maybe you/Dustin should qualify that you are only referring to C# behavior.

  • Anonymous
    September 30, 2008
    Hi, good article, but i think u are the best person to who i can ask this. how to i implemet the auto windows in my editor, msdn say that its not implemente, i have studied and investigated, that AuthoringSink has methos to use with auyos windows, but msnd say that during debug the debugger call a method in languageservice called GetProximityExpressions but for it never reaches it, all other feautes of th vs editor i have already implement but this i couldn't yet, could u help which are the steps i hace to follow to implemte autoswindows

  • Anonymous
    October 14, 2008
    In my VS 2008, the Autos window disappeared and I can't find an option to show it up again! How can I get the window back? Thx for your help!

  • Anonymous
    October 21, 2008
    Patric, it's at Debug>Windows>Autos

  • Anonymous
    November 10, 2008
    GregM, unfortunately, I don't have this option. Within Debug>Windows there's only Breakpoints; Watch; Locals; Call Stack; Threads during debugging. During design, there's only Breakpoints. Do I have to install something or modify VS' settings?

  • Anonymous
    March 02, 2009
    本篇包括tip311-tip320http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-31.html#311、按S...