j_maly
j_maly

Reputation: 1121

Our app crashes during startup - without exception, only "Send report"

Our app crashes during loading probably, only on some machines, I do not get any exception, only the windows "Send report" dialog.

Is there some way to get more information about what is causing the application to crash? In the "Send report" dialog, there is just:

AppName: evox.wpfclient.exe
AppVer: 1.0.0.0
ModName: kernel32.dll ModVer: 5.1.2600.5781
Offset: 00012afb

Upvotes: 2

Views: 1828

Answers (2)

nportelli
nportelli

Reputation: 3916

Handle the AppDomain.CurrentDomain.UnhandledException event in your class that starts up your app. Usually program.cs.

Add

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

then outside the main class

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is Exception)
                _logger.FatalException("Unhandled exception", (Exception)e.ExceptionObject);
            else
                _logger.Fatal("Unhandled exception: {0}", e.ExceptionObject);

            if (_program != null)
                _program.Exit();
        }

to the startup file and see if it catches your exception. of course change the method to suit your purposes.

Upvotes: 3

Phil
Phil

Reputation: 6679

The first thing you do when your application launches, try subscribing to the event System.AppDomain.CurrentDomain.UnhandledException. In the event handler, you can log the exception before the application actually crashes.

If your application still crashes without logging, it's probably a problem with the .NET framework. In that case, you should see an event in the Windows Administration Tools Event Viewer.

Note: you should only use the UnhandledException event to log and then crash - don't try to recover and continue executing.

Upvotes: 1

Related Questions