Merge pull request #1539 from markusstoll/exceptionhandler
catch unhandled exceptions
This commit is contained in:
commit
3fd5e7cd0d
|
@ -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 exception_args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var e = (Exception)exception_args.ExceptionObject;
|
||||||
|
SparkleLogger.WriteCrashReport(e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Environment.Exit (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue