Skip to content

Fix doubled index on macro opcodes in the IL view#3844

Merged
siegfriedpammer merged 1 commit into
masterfrom
fix-il-macro-opcode-double-index
Jun 28, 2026
Merged

Fix doubled index on macro opcodes in the IL view#3844
siegfriedpammer merged 1 commit into
masterfrom
fix-il-macro-opcode-double-index

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Problem

In the IL view the macro load/store opcodes render their index twice: ldarg.0 shows as ldarg.00, ldloc.1 as ldloc.11, stloc.0 as stloc.00, and so on. This only affects the ILSpy UI; ilspycmd -il and the disassembler tests are unaffected.

Cause

MethodBodyDisassembler.WriteOpCode splits these opcodes so the index can be a clickable local/parameter reference: it writes the mnemonic via WriteReference(opCode, omitSuffix: true) and then writes the index via WriteLocalReference.

AvaloniaEditTextOutput.WriteReference implemented omitSuffix as opCode.Name.TrimEnd('.'). The name ends in the index digit, not a dot, so that is a no-op: the full ldarg.0 is written and the index 0 is then appended again → ldarg.00.

PlainTextOutput and the WPF AvalonEditTextOutput instead keep the mnemonic up to and including the last dot (Name.Remove(lastDot + 1)); the Avalonia port regressed this. This restores that behavior and adds a regression test for AvaloniaEditTextOutput.


🤖 This PR was prepared by Claude Code (claude-opus-4-8) on behalf of @siegfriedpammer.

The IL view renders a macro opcode like ldarg.0 as the mnemonic (an opcode
reference) followed by the index written as a separate clickable local or
parameter reference. AvaloniaEditTextOutput's omitSuffix path used
TrimEnd('.') to drop the index, but the name ends in the index digit, not a
dot, so it was a no-op: the full "ldarg.0" was written and the index appended
again, producing "ldarg.00" (and likewise ldloc.NN / stloc.NN).

PlainTextOutput and the WPF AvalonEditTextOutput strip everything after the
last dot; the Avalonia port regressed this. Restore that behavior. Only the UI
was affected -- ilspycmd and the disassembler tests use PlainTextOutput.

Assisted-by: Claude:claude-opus-4-8:Claude Code
@siegfriedpammer siegfriedpammer merged commit d4473c2 into master Jun 28, 2026
13 checks passed
@siegfriedpammer siegfriedpammer deleted the fix-il-macro-opcode-double-index branch June 28, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant