[MonoDevelop] Break only on unhandled exceptions
thenextman
rmarkiewicz at devolutions.net
Wed Nov 14 14:12:18 UTC 2012
Consider the following code:
try
{
int i = 0;
int j = 1;
Console.WriteLine(j / i);
}
catch
{
Console.WriteLine("Caught an exception");
}
Console.ReadLine();
In MonoDevelop, the debugger will not break on the divide by zero unless I
enabled 'Stop in Exceptions' and choose System.DivideByZeroException (or
something less specific, all like System.ArithmeticException or even
System.Exception)
In Visual Studio, I have the option to break on any exception; with the
following two options:
1. When the exception is user-unhandled
2. When the exception is thrown
If I enable (1) for this code, the debugger will not break. However, if I
remove the try/catch, the debugger will break because the exception is now
unhandled.
If I enable (2) for this code, the debugger will always break on the divide
by zero.
My use case in MonoDevelop is, I want to break on exceptions. When my app
bootstraps, a number of exceptions are thrown and caught - I don't care
about these, they are handled. There are several different types of
exception thrown. So what are my options?
1) I can stop on 'System.Exception', and every time I run my app I have to
step through these handled exceptions
2) I can stop on no exceptions, start my app and let it bootstrap, and then
re-enable stop on 'System.Exception'
3) I can customise my list of exceptions to stop in, so it doesn't stop in
the exceptions that occur during bootstrap. But this could prevent the
debugger from breaking on an exception of the same type later on...
Basically I have to keep changing the list of exceptions to stop in, which
is time consuming and unwieldy. It would be great if I could say 'stop in
System.Exception, but only when it's not handled by a catch{}'.
--
View this message in context: http://mono.1490590.n4.nabble.com/Break-only-on-unhandled-exceptions-tp4657307p4657378.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.
More information about the Monodevelop-list
mailing list