Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vb.net Add Watch stop when value changes

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?

like image 610
user279521 Avatar asked Jan 25 '11 14:01

user279521


2 Answers

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.

like image 127
Hans Passant Avatar answered Oct 19 '22 08:10

Hans Passant


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

like image 36
burnside Avatar answered Oct 19 '22 09:10

burnside