Visual Studio debugger - run until next user prompt

162 views Asked by At

I'm in a Visual Studio debugging session, debugging a WinForms app, but I think this question applies to an ASP.Net code-behind debug session also. Let's say that I have lots of breakpoints set and I want to test a condition that requires running a setup test case first, then I want to run another test case that exercises the code again. The first time, I have to hit the Continue (F9) button 5 times to progress through the code breakpoints and finally arrive at the point where I'm prompted for input again. Now I want to input some data and I now want to carefully step through all the breakpoints.

Is there some way I can quickly push a button and tell the debugger to skip all those breakpoints during the setup test case entry and just progress to the next data input field? I know about the run to cursor capablilty, but that doesn't seem any easier than clicking thru all of the breakpoints.

I know this may sound trivial, but I find myself in this situation all the time. I just want a super-continue button.

2

There are 2 answers

0
Philip Pittle On

You can open the Breakpoints window (Debug -> Windows -> Breakpoints) and then you can select multiple breakpoints and disable or enable them as you go:

Breakpoints window

0
codemonkeh On

The best thing i can think of would be to create a condition on the breakpoint to only break when the data is set up.

E.g.

Add conditional breakpoint

Setting the condition for the breakpoint

Or if all else fails, set a BreakPoint Hit Count, if you know it'll always be the 6th break that is relevant. E.g.

Defining a breakpoint hit count