In Visual Studio (2015 and newer), is it possible to have multiple sets of breakpoins? I have several scenarios, I need to debug, but for each of them I would like to have different set of breakpoints. It is quite time-consuming to enable/disable them manually.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can export and import breakpoints from the breakpoints window and then import them as required.
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
.
Or use Debugger.Break()
. Something like:
#if DEBUG
if (testingScenario1)
Debugger.Break();
#endif
标签:
visual-studio