From bcd4af2f9638a9b81e9b8bbec7076ae4ef8ca37b Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 17:25:31 +0100 Subject: [PATCH] Only enable messagebox exception handling in release mode Debug builds are meant to be executed in a IDE environment, so it is better to take advantage of the IDE's features to show where the exception came from. --- Vocaluxe/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index fdd13fd0..f85b67d9 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -45,11 +45,14 @@ namespace Vocaluxe private static void Main(string[] args) // ReSharper restore InconsistentNaming { +#if !DEBUG AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; +#endif AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver; // Close program if there is another instance running if (!_EnsureSingleInstance()) return; +#if !DEBUG try { _Run(args); @@ -65,6 +68,9 @@ namespace Vocaluxe MessageBox.Show("Unhandled error: " + e.Message + stackTrace); CLog.LogError("Unhandled error: " + e.Message + stackTrace); } +#else + _Run(args); +#endif _CloseProgram(); }