Trace When Variable Changes Value

When your code executes, it might change the value of a variable. It is possible to capture such changes and the variable's new value, on the Debug window. You can then double-click on the change record to display the line of code that caused the change, in the Code Editor.

Access     Right-click on variable | Trace When Variable Modified

Set up Trace

The variable you are tracing has to be in scope, so to identify and select it set a normal breakpoint on the line of code where you know that the variable will exist. When the debugger reaches this breakpoint, check either the Locals window or the Watches window (if examining public and static scopes) and locate the variable. Right-click on it and select the menu option.

Now disable the normal breakpoint and run the program. Each time the variable changes value, it will be logged to the output tab of the debugger. Check the change in value and double-click on the line to display the code in the Code Editor.

Notes

The debugger does not halt when the change event occurs, it only logs the change
This facility is available on the Microsoft Native and Java platforms
Microsoft .NET does not support breakpoints on values
 

Learn more