Can I set a breakpoint when variable is getting a specific value in .NET?

前端 未结 7 1945
执念已碎
执念已碎 2020-12-04 23:29

I am using Visual Studio 2010, and I know this feature is available in C++.

I need to debug some code, that changes a variable to several values. I want to debug the

7条回答
  •  执笔经年
    2020-12-05 00:15

    So long as you are using a Visual Studio edition other than Express, you can achieve this in C# using a breakpoint condition.

    In the Breakpoint Condition dialog box, enter a valid expression in the Condition box, such as myLocalVariable > 1

    and

    ...choose Has changed if you want to break when the value of the expression has changed.

    To get to the Has changed option, right-click your breakpoint in the Breakpoints window and select Condition..., then check the screenshot below.

    Has Changed option for breakpoint conditions

提交回复
热议问题