Skip to content

Fix missing ILVerify messages for LdftnCtor and TailStackEmpty - #135877

Merged
jkotas merged 1 commit into
dotnet:mainfrom
pcshrosbree:fix/ilverify-missing-messages
Oct 16, 2026
Merged

jkotas merged 1 commit into
dotnet:mainfrom
pcshrosbree:fix/ilverify-missing-messages

Conversation

@pcshrosbree

Copy link
Copy Markdown
Contributor

Problem: ILVerify reports LdftnCtor and TailStackEmpty with the error name as the message. With the ILVerify CLI built from main (relevant lines; paths shortened):

[IL]: Error [LdftnCtor]: [Probe.dll : P::LdftnCtor()][offset 0x00000000] LdftnCtor
[IL]: Error [TailStackEmpty]: [Probe.dll : P::TailStackNotEmpty()][offset 0x00000004] TailStackEmpty

For errors reported by the IL importer, Verifier looks up the message in Strings.resx by the error's name, and uses the name when the entry is missing or empty (Verifier.cs:394-401). The entry for LdftnCtor is named LdftnConstructor, and TailStackEmpty has no entry.

Fix: rename the entry to LdftnCtor, and add a TailStackEmpty entry with the text of its comment in VerifierError.cs, "Stack not empty after tail call." Renaming the entry rather than the enum member leaves the public VerifierError unchanged, along with the CLI's --ignore-error patterns, which match error names. Nothing else in the repo references LdftnConstructor.

Validation

New test: VerificationResultTests.EveryErrorHasMessage checks that every VerifierError other than None has a non-empty entry in Strings.resx. With the fix reverted, it fails, listing LdftnCtor and TailStackEmpty; every other error already has an entry.

I understand this test may be considered low value for a resource fix, and I have no problem dropping it. I added it because I have seen tools built on PEVerify rely on the message text and break when it changes. The text is not part of the contract, and the test does not check wording; it catches a missing or empty entry, which silently turns a message into the bare error name, as happened here.

ILVerification.Tests, on main at 11ce222, with linux-x64 and SDK 11.0.100-rc.1.26420.103. Each row ran ./dotnet.sh build src/coreclr/tools/ILVerification.Tests/ILVerification.Tests.csproj -c <config>, then ./dotnet.sh test on the same project with --no-build:

Tree Configuration Result
main unchanged Release 484/484
main unchanged Debug 484/484
this change Release 485/485
this change Debug 485/485
new test with the fix reverted Release 484/485; the new test lists LdftnCtor and TailStackEmpty
this change with the entry named LdftnConstructor again Release 484/485; the new test lists LdftnCtor
this change without the TailStackEmpty entry Release 484/485; the new test lists TailStackEmpty

ILVerify CLI, built from this branch, on the same two methods (relevant lines; paths shortened):

[IL]: Error [LdftnCtor]: [Probe.dll : P::LdftnCtor()][offset 0x00000000] ldftn/ldvirtftn not allowed on .ctor.
[IL]: Error [TailStackEmpty]: [Probe.dll : P::TailStackNotEmpty()][offset 0x00000004] Stack not empty after tail call.

Note

This PR was prepared with AI assistance (Anthropic Claude and OpenAI Codex), under my direction. I reviewed it before posting.

For errors reported by the IL importer, Verifier looks up the message
in Strings.resx by the VerifierError name and falls back to that name
if the entry is missing or empty. LdftnCtor's entry was named
LdftnConstructor, and TailStackEmpty had no entry, so both were
reported with the bare error name. Rename the former and add the
latter using its enum comment. Add a test that every error other than
None has a non-empty entry.
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 15, 2026
@github-actions github-actions Bot added the area-Tools-ILVerification Issues related to ilverify tool and IL verification in general label Oct 15, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jkotas

jkotas commented Oct 16, 2026

Copy link
Copy Markdown
Member

/ba-g known failures that are being worked on

@jkotas
jkotas merged commit 21853f5 into dotnet:main Oct 16, 2026
130 of 132 checks passed
@pcshrosbree

Copy link
Copy Markdown
Contributor Author

Thank you for the review and merge!

@pcshrosbree
pcshrosbree deleted the fix/ilverify-missing-messages branch October 17, 2026 03:21
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILVerification Issues related to ilverify tool and IL verification in general community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants