/// <summary> /// Run the application in release mode. Unhandled Exceptions are caught and shown to the user. /// The application will exit. /// </summary> private static void RunInReleaseMode() { AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException; try { var bootstrapper = new CDP4IMEBootstrapper(); bootstrapper.Run(); } catch (Exception ex) { HandleException(ex); } }
/// <summary> /// Run the application in debug mode. Unhandled Exceptions are not caught. /// The application will crash /// </summary> private static void RunInDebugMode() { var bootstrapper = new CDP4IMEBootstrapper(); try { bootstrapper.Run(); } catch (ReflectionTypeLoadException ex) { var sb = new StringBuilder(); foreach (var loaderException in ex.LoaderExceptions) { sb.AppendLine(loaderException.Message); if (loaderException is FileNotFoundException fileNotFoundException) { if (!string.IsNullOrEmpty(fileNotFoundException.FusionLog)) { sb.AppendLine("FusionLog: "); sb.AppendLine(fileNotFoundException.FusionLog); } } sb.AppendLine(); } var errorMessage = sb.ToString(); logger.Fatal(errorMessage, ex); throw new ApplicationException(errorMessage); } catch (Exception ex) { logger.Fatal(ex); throw; } }