Catch all unhandled Exceptions

This commit is contained in:
Markus Stoll 2014-07-20 11:12:22 +02:00
parent 51aa2bf89c
commit 3c54482248

View file

@ -68,6 +68,8 @@ namespace SparkleShare {
} }
try { try {
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
Controller = new SparkleController (); Controller = new SparkleController ();
Controller.Initialize (); Controller.Initialize ();
@ -85,5 +87,18 @@ namespace SparkleShare {
GC.WaitForPendingFinalizers (); GC.WaitForPendingFinalizers ();
#endif #endif
} }
static void OnUnhandledException(object sender, UnhandledExceptionEventArgs exceptionArgs)
{
try
{
var e = (Exception)exceptionArgs.ExceptionObject;
SparkleLogger.WriteCrashReport(e);
}
finally
{
Environment.Exit (-1);
}
}
} }
} }