Martin Perry
Martin Perry

Reputation: 9527

Visual Studio - different sets of breakpoints

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.

Upvotes: 2

Views: 385

Answers (1)

shamp00
shamp00

Reputation: 11326

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

Visual Studio 15 breakpoints window

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

Upvotes: 7

Related Questions