Add [IgnoreILFailure] support to ILLink test framework.#124012
Merged
sbomer merged 1 commit intodotnet:mainfrom Feb 6, 2026
Merged
Add [IgnoreILFailure] support to ILLink test framework.#124012sbomer merged 1 commit intodotnet:mainfrom
[IgnoreILFailure] support to ILLink test framework.#124012sbomer merged 1 commit intodotnet:mainfrom
Conversation
At Unity we have a few tests where we are modifying IL in System.Private.CoreLib and it throws off the diff'ing due to shifted offsets. The only solution today is to disable il verification for all of the assembly. This is not ideal as it means we could let other bugs slip in in the future. This PR adds a way to filter out a given il verification error so that you don't have to disable il verification for the whole assembly. It's a fairly crude mechanism but I think it should be good enough for the limited number of places we want to use it. Also while I'm here, I added `DebuggerDisplay` to `ILVerifierResult`. It's helpful when trying to debug il verification related issues
Contributor
Author
|
@sbomer please take a look |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds functionality to the ILLink test framework that allows selectively ignoring specific IL verification errors through a new [IgnoreILFailure] attribute, rather than disabling IL verification for entire assemblies. This is particularly useful when modifying IL in System.Private.CoreLib where offset shifts can cause verification diffs.
Changes:
- Introduces
[IgnoreILFailure]attribute to filter specific IL verification errors based on message content - Adds
[DebuggerDisplay]attribute toILVerifierResultfor improved debugging experience - Includes a test case demonstrating the new ignore functionality
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
ILVerifierResult.cs |
Adds DebuggerDisplay attribute and System.Diagnostics import for easier debugging |
ILChecker.cs |
Implements filtering logic for ignored IL verification errors using the new attribute |
ILVerificationErrorsCanBeIgnored.cs |
Test case demonstrating the [IgnoreILFailure] attribute usage |
IgnoreILFailureAttribute.cs |
New attribute definition for marking specific IL failures to ignore |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
Contributor
Author
|
@sbomer Can you merge the PR? |
lewing
pushed a commit
to lewing/runtime
that referenced
this pull request
Feb 9, 2026
) At Unity we have a few tests where we are modifying IL in System.Private.CoreLib and it throws off the diff'ing due to shifted offsets. The only solution today is to disable il verification for all of the assembly. This is not ideal as it means we could let other bugs slip in in the future. This PR adds a way to filter out a given il verification error so that you don't have to disable il verification for the whole assembly. It's a fairly crude mechanism but I think it should be good enough for the limited number of places we want to use it. Also while I'm here, I added `DebuggerDisplay` to `ILVerifierResult`. It's helpful when trying to debug il verification related issues
iremyux
pushed a commit
to iremyux/dotnet-runtime
that referenced
this pull request
Mar 2, 2026
) At Unity we have a few tests where we are modifying IL in System.Private.CoreLib and it throws off the diff'ing due to shifted offsets. The only solution today is to disable il verification for all of the assembly. This is not ideal as it means we could let other bugs slip in in the future. This PR adds a way to filter out a given il verification error so that you don't have to disable il verification for the whole assembly. It's a fairly crude mechanism but I think it should be good enough for the limited number of places we want to use it. Also while I'm here, I added `DebuggerDisplay` to `ILVerifierResult`. It's helpful when trying to debug il verification related issues
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
At Unity we have a few tests where we are modifying IL in System.Private.CoreLib and it throws off the diff'ing due to shifted offsets. The only solution today is to disable il verification for all of the assembly. This is not ideal as it means we could let other bugs slip in in the future. This PR adds a way to filter out a given il verification error so that you don't have to disable il verification for the whole assembly. It's a fairly crude mechanism but I think it should be good enough for the limited number of places we want to use it.
Also while I'm here, I added
DebuggerDisplaytoILVerifierResult. It's helpful when trying to debug il verification related issues