From 64e020b1adc1c355ec0b35681c3f1254a18aae73 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Fri, 6 Nov 2015 19:55:48 +0000 Subject: [PATCH] Better crash report --- Wox/App.xaml.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index dc9d159461..5b239e0851 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Windows; @@ -32,9 +33,7 @@ namespace Wox Stopwatch.Debug("Startup Time", () => { base.OnStartup(e); - DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException; - AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle; - + RegisterUnhandledException(); ThreadPool.QueueUserWorkItem(o => { ImageLoader.ImageLoader.PreloadImages(); }); Window = new MainWindow(); PluginManager.Init(Window); @@ -43,6 +42,14 @@ namespace Wox } + [Conditional("DEBUG")] + private void RegisterUnhandledException() + { + // let exception throw as normal is better for Debug + DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException; + AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle; + } + public bool OnActivate(IList args) { CommandArgsFactory.Execute(args);