void DecompilationThread()
        {
            try {
                StringWriter writer = new StringWriter();
                RunDecompiler(assemblyFile, fullTypeName, new DebuggerTextOutput(new PlainTextOutput(writer)), cancellation.Token);
                if (!cancellation.IsCancellationRequested)
                {
                    WorkbenchSingleton.SafeThreadAsyncCall(OnDecompilationFinished, writer);
                }
            } catch (OperationCanceledException) {
                // ignore cancellation
            } catch (Exception ex) {
                if (cancellation.IsCancellationRequested)
                {
                    MessageService.ShowException(ex);
                    return;
                }
                AnalyticsMonitorService.TrackException(ex);

                StringWriter writer = new StringWriter();
                writer.WriteLine(string.Format("Exception while decompiling {0} ({1})", fullTypeName, assemblyFile));
                writer.WriteLine();
                writer.WriteLine(ex.ToString());
                WorkbenchSingleton.SafeThreadAsyncCall(OnDecompilationFinished, writer);
            }
        }
Пример #2
0
        static void ShowErrorBox(Exception exception, string message, bool mustTerminate)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            // ignore reentrant calls (e.g. when there's an exception in OnRender)
            if (showingBox)
            {
                return;
            }
            showingBox = true;
            try {
                try {
                    AnalyticsMonitorService.TrackException(exception);
                } catch (Exception ex) {
                    LoggingService.Warn("Error tracking exception", ex);
                }
                using (ExceptionBox box = new ExceptionBox(exception, message, mustTerminate)) {
                    if (ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.InvokeRequired)
                    {
                        box.ShowDialog();
                    }
                    else
                    {
                        box.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWin32Window);
                    }
                }
            } catch (Exception ex) {
                LoggingService.Warn("Error showing ExceptionBox", ex);
                MessageBox.Show(exception.ToString(), message, MessageBoxButtons.OK,
                                MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            } finally {
                showingBox = false;
            }
        }