1.1.15 The Autos Window

Overview

When a C# program is paused in the debugger, Visual Studio can display runtime information in several debugger windows.

The Autos window focuses on variables, references, and expressions related to the current and nearby statements.

It is useful when you want to answer:

Begin With a Breakpoint

Suppose the source contains:

Player player1 = new Player();
player1.name = "Jordan";
player1.jerseyNumber = 7;

Set a breakpoint at a useful location and start debugging.

When execution pauses, open the Autos window using the course's Visual Studio workflow.

The exact layout can vary by Visual Studio version.

Focus on the information rather than memorizing one screen arrangement.

Values Depend on Where Execution Is Paused

If execution pauses before:

Player player1 = new Player();

then the object has not yet been created by that statement.

If execution pauses immediately after the statement, player1 can refer to the new Player object.

If execution pauses after the field assignments, the object can show the updated state.

Debugger evidence always belongs to a specific moment in execution.

Expand an Object to Inspect Its Members

If the Autos window shows:

Activity diagram showing before 0, then after 7.
Before.
  • New
  • Changed
  • Removed

That connects:

source statement → execution → state change
Autos Can Help With Object References Too

If a field or variable can refer to another object, Autos may show:

null

before a reference is assigned.

Later, it may show an expandable object.

That difference becomes especially useful in CO-029 when diagnosing nested references and NullReferenceException.

Do Not Change Code Based Only on a Surprising Value

If a value looks wrong, first ask:

  • Has the assignment executed yet?
  • Am I inspecting the intended object?
  • Is this the correct breakpoint?
  • Does the UML or requirement expect a different value?

The debugger provides evidence.

You still need to interpret it in relation to the code and model.

The Main Use

The Autos window helps answer:

Use it to connect the written source with the runtime state you can actually observe.