Debugging Technique

How to use "locals" and "watch" windows to show va

Page 1 of 1

1 Replies - 2208 Views - Last Post: 18 August 2008 - 06:01 PM Rate Topic: -----

#1 Junije  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 08-July 08

Debugging Technique

Post icon  Posted 18 August 2008 - 02:47 PM

Hi,

This is more of a C# IDE question then a programming related one.
I'd like to use the "locals" and "watch" window to show variables I want to keep an eye on, but never learned how to use it properly.
I've never used any of the debugging possibilities in the Microsofts' C# IDE, but I usually improvised by creating a separate form which showed the variables I needed to monitor, but since this is not the right way, nor professional way to debug, I'd like to leave that practice.

I haven't found much info about debugging in C#, and what I have found is poorly explained for a beginner to understand.

I've tried typing a variable name into a watch window in the "name" row, while in break mode in the IDE, but no matter which variable I type in it always ends up with "The name ("variable name") does not exist in the current context" in the "value" row.

I have an array of several objects created from a class and I would like to track all of them and their variables, so can someone please explain me how can I do this properly?

Is This A Good Question/Topic? 0
  • +

Replies To: Debugging Technique

#2 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: Debugging Technique

Posted 18 August 2008 - 06:01 PM

Quote

I've tried typing a variable name into a watch window in the "name" row, while in break mode in the IDE, but no matter which variable I type in it always ends up with "The name ("variable name") does not exist in the current context" in the "value" row.

Make sure you typed the variable name in the watch window case-sensitive, and that it is inside the class or method you are stopped at. If you stopped at a breakpoint, and type a variable that is visible from that code, it will display. An easier way to do it is with the Locals box. It will automatically display the variables in the current method, and update them when they are changed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1