Partager via


Using Variable Windows

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The Visual Studio 2005 debugger has three variable windows: Autos, Locals, and Watch. The Autos window displays the value of variables used in the current and previous lines of code. The Locals window displays the value of variables that are local to the scope of the currently active method. Either of these windows can be used to find recognition results and other values that determine the behavior of your application.

By adding variables or expressions to the Watch window, you can track their values as they change during the execution of your application.

To open a variable window

  1. In Visual Studio 2005, click Windows on the Debug menu.

  2. Select Autos, or Locals, or Watch.

Using the Autos Window to Inspect a Variable

To use the Autos window to inspect a variable

  1. In VoiceResponseWorkflow1.cs, locate the OnEntry method, and then place the cursor on the first line of code.

    The first line of code in OnEntry is:

    if (QueryString == null || QueryString["OutboundPhoneNumber"] = null)
    
  2. Set a breakpoint on the first line of code in OnEntry.

    For information about how to set a breakpoint, see Using Breakpoints.

  3. Start the Survey tutorial application in the debugger.

    For information about starting the application in the debugger, see Debugging the Survey Application.

  4. Open the Autos window as described in the previous procedure.

  5. In the Name column of the Autos window, select the expression QueryString["OutboundPhoneNumber"].

    This expression should have a value of 5550187.

  6. Press F5 to restart the application.

Using the Autos Window to Change the Value of a Variable

To use the Autos window to change the value of a variable

  1. In VoiceResponseWorkflow1.cs, locate the movieAttendance_Executing method, and then place the cursor on the first statement.

    The first statement in movieAttendance_Executing is:

    this.movieAttendance.MainPrompt.ClearContent();
    
  2. Set a breakpoint on the first statement in movieAttendance_Executing.

    For information about how to set a breakpoint, see Using Breakpoints.

  3. Start the Survey tutorial application in the debugger.

    For information about starting the application in the debugger, see Debugging the Survey Application.

    When the Survey tutorial application reaches the statement on which you set the breakpoint, execution halts.

  4. Open the Autos window as described in the previous procedure.

  5. Press F10 to execute the next statement.

    Notice that moviesPerYear is null and that this.askMovieAttendance.RecognitionResult.Semantics.Value is a string that contains the number of movies you spoke to the application.

  6. In the Name column of the Autos window, select the expression this.askMovieAttendance.RecognitionResult.Semantics.Value.

  7. Right-click the expression, and then click Edit Value.

  8. In the Value column, change the value.

    Be sure to include quotation marks around the value.

  9. Press F10 to execute the next statement.

    Notice that moviesPerYear is now set to the value you entered in step 8.

  10. Press F5 to restart the application.