Debug menu – Exceptions – put a tick in Thrown on the Common Language Runtime Exceptions.
When you do this it breaks on all exceptions which is great.
You can add other exceptions to that pack, and or enable or disable individuals, but that’s a bit of effort.
Is there a way to supress the break into debugger using a source directive? Some sort of comment or pragma or anything like that?
I have one bit of code where I can’t, not have an exception thrown and it is a bit of a pain having the debugger break on it. I prefer to have VS break on any exception thrown though, just, in this case, no this one.
Thanks
You can do this using the DebuggerStepThrough attribute on the method that contains the code that you don’t want to break on. You should isolate the specific lines of code that throw the exception into a smaller method and annotate that method with the DebuggerStepThrough attribute so you’re not affecting the rest of your existing method.