66604

How can I add variables to the Watch window

Question:

Visual Studio 2008 Pro: Ok! from the Customize section I added the toolbar commands for Watch,QuickWatch,...to the Debug menu but I want to carefully watch one variable. How do we add it to the Watch? I highlight it and try to add it but it is disabled. I want to be able to first adding some variables of interest to the watch and then start debugging the program.

Answer1:

You will be able to add, view and remove variables from the Watch Mode when you are running under the debugger and execution is paused. The easiest way to get into such a state:

<ol><li>Open your project in Visual Studio</li> <li>Set a breakpoint in the code within the scope of a variable you'd like to watch. Make sure that the code branch you're breaking on will be executed.</li> <li>Hit F5 or go to Debug > Start Debugging</li> <li>When the breakpoint is hit, add your variable to the watch window in any of the following ways: <ul><li>Right click on the variable in code, and select "Add Watch"</li> <li>Right click on the variable in the "Locals" windows, and select "Add Watch"</li> <li>Type the variable name into a new row in the Watch pane itself.</li> </ul></li> </ol>

Afterwards, you should see the variable name and value in the watch pane. The value will be updated as you step through the code and any time you pause execution or hit a breakpoint.

Answer2:

You need to be in debugging in order to add variables to the Watch Window.

When debugging, you can just right click a variable and choose to add it to the watch.

Recommend

  • Nested templates workaround for MSVC2010?
  • R S4 roxygen2 documentation
  • Android Ripple: How do other apps make their ripple so transparent without affecting the original co
  • Random access image (picture) file
  • Reading from Windows registry in Perl [duplicate]
  • How do I configure Maven Cargo to use an embedded Tomcat server?
  • IE11 textarea loses focus if another textarea is disabled
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • how to read a file in prolog?
  • Thread synchronization with syncwarp
  • How can I reset dropdown data if modal closed on vue component?
  • Google Maps api v3 get start and end coordinates of a street
  • Spring integration inbound-gateway Fire an event when queue is empty
  • Image map in Flex
  • Redshift Querying: error xx000 disk full redshift
  • How to getText() from the input field of an angularjs Application
  • Bash if statement with multiple conditions
  • Memory error in python- how to use more memory
  • Debugging VB6 Code From Visual Studio 2010
  • How do I include a SWC in an AS2 Flash project?
  • How to add a focus style to an editable ComboBox in WPF
  • How to remove a SwiftyJSON element?
  • Differences in dis-assembled C code of GCC and Borland?
  • How do I superscript characters in a UIButton?
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • debug library loaded with ctypes using gdb
  • Swift: Switch statement fallthrough behavior
  • Algorithm for a smudge tool?
  • Debugging ASP.NET on a built-in web server suddenly stops
  • Insert into database using onclick function
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • How to extract text from Word files using C#?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • python regex in pyparsing
  • Android Google Maps API OnLocationChanged only called once
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Checking variable from a different class in C#
  • Does armcc optimizes non-volatile variables with -O0?
  • Conditional In-Line CSS for IE and Others?
  • How can I use threading to 'tick' a timer to be accessed by other threads?