diff --git a/ILSpy/TreeNodes/ResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceEntryNode.cs index 7eb246f71..1cff10836 100644 --- a/ILSpy/TreeNodes/ResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceEntryNode.cs @@ -45,21 +45,23 @@ namespace ICSharpCode.ILSpy.TreeNodes AvalonEditTextOutput output = new AvalonEditTextOutput(); IHighlightingDefinition highlighting = null; - textView.RunWithCancellation( - token => Task.Factory.StartNew( - () => { - try { - if (LoadImage(output)) - highlighting = null; - else if (LoadBaml(output)) - highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml"); - } catch (Exception ex) { - output.Write(ex.ToString()); - } - return output; - }), - t => textView.Show(t.Result, highlighting) - ); + if (LoadImage(output)) { + textView.Show(output, highlighting); + } else { + textView.RunWithCancellation( + token => Task.Factory.StartNew( + () => { + try { + if (LoadBaml(output)) + highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml"); + } catch (Exception ex) { + output.Write(ex.ToString()); + } + return output; + }), + t => textView.Show(t.Result, highlighting) + ); + } return true; }