[release/10.0] Don't warn if we can't find the backing field in trim tools#119857
Merged
agocke merged 7 commits intodotnet:release/10.0from Sep 19, 2025
Merged
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ere is a single valid field
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes unnecessary warnings when trim tools can't find backing fields for properties. The main purpose is to eliminate false positive warnings (IL2042) that were being generated when the trimmer couldn't locate backing fields, which was causing noise in the tooling output.
Key changes:
- Removed IL2042 warning logic that flagged missing backing fields
- Simplified backing field validation logic to focus on actual conflicts
- Updated test expectations to remove the now-obsolete warning cases
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PropertyDataFlow.cs | Removed expected IL2042 warnings from test cases and restructured property test scenarios |
| FlowAnnotations.cs (linker) | Simplified backing field detection logic and removed IL2042 warning generation |
| DiagnosticId.cs | Marked IL2042 diagnostic ID as unused |
| FlowAnnotations.cs (analyzer) | Minor refactoring to combine conditions for auto-property detection |
| FlowAnnotations.cs (aot) | Applied same backing field logic simplification as in linker version |
sbomer
approved these changes
Sep 18, 2025
sbomer
reviewed
Sep 18, 2025
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs
Outdated
Show resolved
Hide resolved
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.
Backport of #119820
We added a warning when we cannot find the backing field of an auto property in #119329 which caused some issues in illink->ilc scenarios when an auto property was stubbed out. Instead, we should just not propagate the DAM annotation. If failing to find the backing field doesn't affect the trim safety, no warnings should be surfaced.
Customer Impact
Regression
The previous change introduced new warnings in situations that didn't arise before.
Testing
New unit tests were added, and existing tests were updated to expect the new behavior.
Risk
Low. This only removes warnings that occur when the tools can't find a backing field for an auto-property. No trim-safety warnings or trim behavior should be changed.