From 07ead4fe3327b6a3b722b771f04eec859189aa91 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 1 Jul 2026 09:51:50 +0200 Subject: [PATCH] Skip debug-step node tracking on normal decompiles NodeLookup population runs per AST node (and per annotation) on every on-screen C# decompile, but the debug-step highlighter only consumes it when a step limit is set. Gate the node-tracking token writer on StepLimit so the common Release path skips the bookkeeping; AvaloniaEditTextOutput is an ISmartTextOutput, so it still gets full syntax highlighting via the existing branch. Assisted-by: Claude:claude-opus-4-8:Claude Code --- ILSpy/Languages/CSharpLanguage.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs index 4439e40ee..679f2317d 100644 --- a/ILSpy/Languages/CSharpLanguage.cs +++ b/ILSpy/Languages/CSharpLanguage.cs @@ -713,7 +713,11 @@ namespace ICSharpCode.ILSpy.Languages syntaxTree.AcceptVisitor(new InsertParenthesesVisitor { InsertParenthesesForReadability = true }); output.IndentationString = settings.CSharpFormattingOptions.IndentationString; TokenWriter tokenWriter = new TextTokenWriter(output, settings); - if (output is TextView.AvaloniaEditTextOutput avaloniaOutput) + // Node-range tracking (NodeLookup) is only consumed by the debug-step highlighter, which + // resolves nothing without a step limit. Skip it on a normal decompile so the common path + // doesn't pay the per-node/per-annotation bookkeeping; AvaloniaEditTextOutput is an + // ISmartTextOutput, so the branch below still gives it full syntax highlighting. + if (output is TextView.AvaloniaEditTextOutput avaloniaOutput && options.StepLimit != int.MaxValue) tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, avaloniaOutput); else if (output is TextView.ISmartTextOutput smartOutput) tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, smartOutput);