From 53fa2b3e91546f78c33c65e3aa6ef75ff6382a96 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 23 Feb 2011 17:22:29 +0100 Subject: [PATCH] Even in debug builds: catch decompiler exceptions when no debugger is attached. --- ILSpy/TextView/DecompilerTextView.cs | 38 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index 7b628539e..e4355a1ca 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -264,21 +264,31 @@ namespace ICSharpCode.ILSpy.TextView Thread thread = new Thread(new ThreadStart( delegate { - try { - AvalonEditTextOutput textOutput = new AvalonEditTextOutput(); - textOutput.LengthLimit = outputLengthLimit; - DecompileNodes(context, textOutput); - textOutput.PrepareDocument(); - tcs.SetResult(textOutput); - #if DEBUG - } catch (AggregateException ex) { - tcs.SetException(ex); - } catch (OperationCanceledException ex) { - tcs.SetException(ex); - #else - } catch (Exception ex) { - tcs.SetException(ex); + #if DEBUG + if (Debugger.IsAttached) { + try { + AvalonEditTextOutput textOutput = new AvalonEditTextOutput(); + textOutput.LengthLimit = outputLengthLimit; + DecompileNodes(context, textOutput); + textOutput.PrepareDocument(); + tcs.SetResult(textOutput); + } catch (AggregateException ex) { + tcs.SetException(ex); + } catch (OperationCanceledException ex) { + tcs.SetException(ex); + } + } else #endif + { + try { + AvalonEditTextOutput textOutput = new AvalonEditTextOutput(); + textOutput.LengthLimit = outputLengthLimit; + DecompileNodes(context, textOutput); + textOutput.PrepareDocument(); + tcs.SetResult(textOutput); + } catch (Exception ex) { + tcs.SetException(ex); + } } })); thread.Start();