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.
This commit is contained in:
Stephan Sundermann authored and Florian Küpper committed 2013-12-26 13:03:24 +01:00
1 parent 680351a452
commit bcd4af2f96
1 file changed
+6
+6
View File
@@ -45,11 +45,14 @@ namespace Vocaluxe
private static void Main(string[] args) private static void Main(string[] args)
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
{ {
#if !DEBUG
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
#endif
AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver; AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver;
// Close program if there is another instance running // Close program if there is another instance running
if (!_EnsureSingleInstance()) if (!_EnsureSingleInstance())
return; return;
#if !DEBUG
try try
{ {
_Run(args); _Run(args);
@@ -65,6 +68,9 @@ namespace Vocaluxe
MessageBox.Show("Unhandled error: " + e.Message + stackTrace); MessageBox.Show("Unhandled error: " + e.Message + stackTrace);
CLog.LogError("Unhandled error: " + e.Message + stackTrace); CLog.LogError("Unhandled error: " + e.Message + stackTrace);
} }
#else
_Run(args);
#endif
_CloseProgram(); _CloseProgram();
} }