How do I “run until this variable changes” when debugging?

前端 未结 8 779
醉话见心
醉话见心 2020-12-30 23:29

When debugging my C#, I often want to know when a variable\'s value changes and then investigate the state of the program.

Currently, I do

8条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 00:07

    1. Set the breakpoint where you want the code to pause
    2. Open the Breakpoints window (Debug -> Windows -> Breakpoints)
    3. Right-click on your breakpoint and select Condition...
    4. Set the condition to be the variable name, and select the Has Changed radio button.
    5. Click OK, and then debug as per normal :)

提交回复
热议问题