I have a property inside a class that is getting changed by something. The only place I change the value of this code is a line that looks like this:
pushpin.Position.Altitude = -31;
During visual studio debugging, is there a way to watch .Altitude for any changes made, preferably it breaks at the assignment statement that changes the value.
If this is the correct way to track down this problem, could I have a step-by-step tutorial/instruction on how to do this?
Thanks.
When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.
Yes u can if you have the authorization: while debugging do a doubleclick on the variable, the system'll show the name and the value of the variable, change the value and press CHANGE icon.
If this is a property then you can do this by adding a breakpoint to the set method of the property. Putting the cursor in the set statement and hit F9 will create the break point.
If this is a field then there's no way to watch this directly. Breaking when a field changes a value is a supported operation in C++, known as data break points, but is not supported in the CLR. The best work around is to convert the field to a property temporarily and break on the set statement.
EDIT
Updating based on OP saying it's a 3rd party DLL.
In this case you want to use the Break at Function feature of Visual Studio. The first step is to disable Just My Code.
Next actually set the named break point
You may need to fully qualify the name in order to get it to work
You can set a conditional breakpoint by setting the bp and then right-click to specify a condition upon which to break at that line.
You can add a 'Watch' to a variable and specify to break anywhere/anytime the value changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With