0

Trying to debug a try catch that gets iterated through MANY times before an error pops up in one of the iterations. Is there a way other then setting a breakpoint at the beginning of the try catch and spamming f10? This is problematic for many reasons...

Guess I could do a count and display what iteration its failing on but that seems so extra. Does anything exist that can help me?

P.S. I'm on VS2015 Enter

Capn Jack
  • 1,201
  • 11
  • 28

2 Answers2

4

Is there a way other then setting a breakpoint at the beginning of the try catch and spamming f10?

Yes there is and that's known as conditional break point. Put a break point and then hold your mouse on the break point. Click on the settings icon and select the condition checkbox and provide your condition (say, when iteration becomes 10). It will break only when condition meets or condition become true

enter image description here

Rahul
  • 76,197
  • 13
  • 71
  • 125
  • 1
    Conditional break points work, but I've found that they really slow the debugger even when you are not executing code near the break point. (At least that was the case before I stopped using them). You can get a faster execution if you put the condition into an if statement and call `Debugger.Break()`. – mrfelis Jun 15 '17 at 23:33
0

If you know something about the state that triggers the exception you can use a conditional breakpoint.

https://blogs.msdn.microsoft.com/visualstudioalm/2014/10/06/new-breakpoint-configuration-experience-in-visual-studio-2015/

dnickless
  • 10,733
  • 1
  • 19
  • 34