-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/10.0] Don't warn if we can't find the backing field in trim tools #119857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/10.0] Don't warn if we can't find the backing field in trim tools #119857
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…ere is a single valid field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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
JulieLeeMSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
CC @jeffschwMSFT.
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.