vb.net Add Watch stop when value changes

11,066

Solution 1

Data breakpoints is what I remember, your description matches. It used a processor feature, it requires the address of the variable and the size, the processor automatically generates a trap when it detects a write to the memory address. Very nice debugging tool.

Sadly no longer available in managed code, the garbage collector messes it up because it moves objects around while compacting the heap. Which changes their address. The interface between the garbage collector and the debugger isn't strong enough to allow the debugger to track these moves while the compacting is taking place at runtime. No doubt to avoid a serious amount of overhead.

The next best thing you got is a property setter. You can set a breakpoint on it.

Solution 2

Right click on the breakpoint and hit Condition. You should be able to do the same from here.

Share:
11,066

Related videos on Youtube

user279521
Author by

user279521

.Net developer in training; working on multiple projects at any given time (austink_2004);

Updated on May 17, 2022

Comments

  • user279521
    user279521 about 2 years

    I know in the older versions of Visual Studio, there was an "Add Watch" option where you can choose to stop execution when the value of the field changed. I am using VS 2010, and I can't figure out how to hit the breakpoint when the value of the field changes.

    Any ideas?

  • user279521
    user279521 over 13 years
    I was afraid that would be the case... :-(
  • user279521
    user279521 over 13 years
    don't think this is what I need, since the condition "has changed" occurs AFTER the breakpoint is hit .....