ILVerify: soft comparison ignoring IL byte offset drift#19553
Open
techiedesu wants to merge 2 commits intodotnet:mainfrom
Open
ILVerify: soft comparison ignoring IL byte offset drift#19553techiedesu wants to merge 2 commits intodotnet:mainfrom
techiedesu wants to merge 2 commits intodotnet:mainfrom
Conversation
Add offset-tolerant fallback to ILVerify baseline comparison so that changes which only shift IL byte offsets no longer fail CI.
Contributor
✅ No release notes required |
Author
|
@dotnet-policy-service agree |
T-Gro
reviewed
Apr 9, 2026
| Invoke-Expression $fn.Extent.Text | ||
| } | ||
|
|
||
| Describe "Normalize-IlverifyOutputLine" { |
Member
There was a problem hiding this comment.
Nice!
This definitely sets the bar higher for future powershell code changes in this repo 👍
T-Gro
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements soft comparison for ILVerify baseline checks, as discussed in #18090.
IL byte offsets (
[offset 0x...]) in ILVerify output shift whenever code above the error site changes, even though the verification error itself is semantically identical. This causes spurious CI failures on unrelated PRs.Changes
tests/ILVerify/ilverify.ps1: AddedRemove-IlverifyOffsetsfunction and a two-level comparison: exact match is tried first; if it fails, a soft comparison (ignoring IL offsets and trailing whitespace) is used as a fallback. Soft match = success with a warning to update baselines. Also cleaned up a misleading comment on the$ignore_errorsvariable.tests/ILVerify/ilverify.Tests.ps1: New Pester test file — 17 tests coveringNormalize-IlverifyOutputLine,Remove-IlverifyOffsets, and end-to-end soft comparison scenarios.DEVGUIDE.md: Documented the soft comparison behavior and the/run ilverifyPR comment command..github/skills/ilverify-failure/SKILL.md: Added section on offset-only differences.What this does NOT change
The full pseudocode in #18090 also proposed making "baseline does not exist" a success. This PR intentionally leaves that behavior unchanged to keep the scope minimal and the risk low — it can be addressed separately if desired.
Fixes #18090
Checklist
🤖 This PR was researched and implemented with assistance from Claude Code.