Exemple #1
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var globalMutex = new GlobalMutex("PDFCreator-137a7751-1070-4db4-a407-83c1625762c7");

            globalMutex.Acquire();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            Thread.CurrentThread.Name = "ProgramThread";

            try
            {
                LoggingHelper.InitFileLogger("PDFCreator", LoggingLevel.Error);

                RunApplication(e.Args);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "There was an error while starting PDFCreator");

                ErrorAssistant.ShowErrorWindowInNewProcess(ex);
            }
            finally
            {
                globalMutex.Release();
                Logger.Debug("Ending PDFCreator");
                Shutdown();
            }
        }
Exemple #2
0
        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var ex = (Exception)e.ExceptionObject;

            Logger.Fatal(ex, "Uncaught exception, IsTerminating: {0}", e.IsTerminating);
            ErrorAssistant.ShowErrorWindowInNewProcess(ex);
        }
        private Report CreateReport(ErrorAssistant errorAssistant, Exception ex)
        {
            var report = errorAssistant.BuildReport(ex, BuildAdditionalEntries());

            report.Log.AddRange(_inMemoryLogger.LogEntries);

            return(report);
        }
Exemple #4
0
        private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            Logger.Error(e.Exception, "Uncaught exception in WPF thread");

            e.Handled = true;

            bool terminateRequested;

            ErrorAssistant.ShowErrorWindow(e.Exception, out terminateRequested);

            if (terminateRequested)
            {
                Current.Shutdown(1);
            }
        }