且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio - 不同的断点集

更新时间:2023-02-27 13:19:59

您可以从断点窗口导出和导入断点,然后根据需要导入它们.

You can export and import breakpoints from the breakpoints window and then import them as required.

或者,如果您不介意修改代码,您可以使用条件断点并在代码中设置条件.例如,设置一个布尔值 testingScenario1 = true,然后在断点上设置断点条件,以仅在 testingScenario1 == true 时中断.

Alternatively, if you don't mind modifying your code, you can use conditional breakpoints and set the condition in your code. E.g., set a boolean testingScenario1 = true and then set a breakpoint condition on the breakpoint to only break when testingScenario1 == true.

或者使用Debugger.Break().类似的东西:

Or use Debugger.Break(). Something like:

#if DEBUG
    if (testingScenario1)
        Debugger.Break();
#endif

推荐文章