diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index 4e748fd2ac..3b9ea493ce 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -1447,17 +1447,20 @@ public static void RegisterHighlighting( if (resourceStream != null) { + IHighlightingDefinition highlightingDefinition; + + using (resourceStream) + using (XmlTextReader reader = new XmlTextReader(resourceStream)) + { + highlightingDefinition = HighlightingLoader.Load(reader, manager); + } + manager.RegisterHighlighting( - name, extensions, - delegate { - using (resourceStream) - using (XmlTextReader reader = new XmlTextReader(resourceStream)) - { - var highlightingDefinition = HighlightingLoader.Load(reader, manager); - ThemeManager.Current.ApplyHighlightingColors(highlightingDefinition); - return highlightingDefinition; - } - }); + name, extensions, + delegate { + ThemeManager.Current.ApplyHighlightingColors(highlightingDefinition); + return highlightingDefinition; + }); } } }