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