.Net Framework 4.6.1
Why the AppDomain.UnhandledException
event doesn't happen in my case?
class MyClass {
static void Main(string[] args) {
AppDomain.CurrentDomain.UnhandledException +=
UnhandledExceptionHandling;
int a = 2;
int b = 0;
// Here I expected a jump to
// UnhandledExceptionHandling...
// But I get the DivideByZeroException exception
// instead of.
int c = a / b;
}
private static void UnhandledExceptionHandling(
Object sender, UnhandledExceptionEventArgs e) {
// But I don't get here...
Console.WriteLine(((Exception)
e.ExceptionObject).Message);
}
}