I am trying to destroy the application . (I also managed to collapse it using the Hans code from How to simulate a corrupt state exception in .NET 4? ".)
The application calls the above emergency code when a button is pressed. Here are my exception handlers:
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; DispatcherUnhandledException += app_DispatcherUnhandledException; } [HandleProcessCorruptedStateExceptions] void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
Comment //log... shown above is just for illustration; there is a real registration code.
When working in Visual Studio, an exception is thrown, but it does not “bubble” up to these exception handler blocks. When working offline (without an attached debugger) I do not get any log, despite what I expect.
Why is this so, and how to make the processing code executed?
user286353
source share