Skip to content

ILVerify: soft comparison ignoring IL byte offset drift#19553

Merged
T-Gro merged 4 commits into
dotnet:mainfrom
techiedesu:ilverify-soft-comparison
Jun 23, 2026
Merged

ILVerify: soft comparison ignoring IL byte offset drift#19553
T-Gro merged 4 commits into
dotnet:mainfrom
techiedesu:ilverify-soft-comparison

Conversation

@techiedesu

Copy link
Copy Markdown
Contributor

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: Added Remove-IlverifyOffsets function 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_errors variable.
  • tests/ILVerify/ilverify.Tests.ps1: New Pester test file — 17 tests covering Normalize-IlverifyOutputLine, Remove-IlverifyOffsets, and end-to-end soft comparison scenarios.
  • DEVGUIDE.md: Documented the soft comparison behavior and the /run ilverify PR 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

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

This PR only changes CI tooling and documentation — no compiler/FSharp.Core sources were modified. NO_RELEASE_NOTES label is appropriate.


🤖 This PR was researched and implemented with assistance from Claude Code.

Add offset-tolerant fallback to ILVerify baseline comparison so that
changes which only shift IL byte offsets no longer fail CI.
@github-actions

github-actions Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

✅ No release notes required

@techiedesu

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

Comment thread tests/ILVerify/ilverify.Tests.ps1
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Apr 9, 2026
@T-Gro T-Gro enabled auto-merge (squash) April 9, 2026 12:46
@T-Gro T-Gro merged commit 9b04b4b into dotnet:main Jun 23, 2026
50 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

ILVerify check improvements

2 participants