Exemplo n.º 1
0
        protected void GlobalExceptionHandler(object sender, UnhandledExceptionEventArgs e)
        {
            Logger.Fatal("A unhandled exception has occured. Exception = {0}", LogSource.UI, (Exception)e.ExceptionObject);

            // Log error synchronously since we are probably crashing
            UnhandledExceptionWindow.LogError((Exception)e.ExceptionObject);

            ShowErrorDialog((Exception)e.ExceptionObject);
        }
Exemplo n.º 2
0
        protected void GlobalWPFExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            var ex = e.Exception;

            if (ex is ReflectionTypeLoadException)
            {
                var rtl = ((ReflectionTypeLoadException)ex);

                if (rtl.LoaderExceptions.Length > 0)
                {
                    ex = rtl.LoaderExceptions[0];
                }
            }

            Logger.Fatal("A unhandled Dispatcher exception has occured. Exception = {0}", LogSource.UI, ex);

            e.Handled = true;

            ThreadPool.QueueUserWorkItem(state => UnhandledExceptionWindow.LogError(e.Exception));

            ShowErrorDialog(e.Exception);
        }