Don't warn if we can't find the backing field in trim tools#119820
Merged
jtschuster merged 12 commits intodotnet:mainfrom Sep 22, 2025
Merged
Don't warn if we can't find the backing field in trim tools#119820jtschuster merged 12 commits intodotnet:mainfrom
jtschuster merged 12 commits intodotnet:mainfrom
Conversation
sbomer
reviewed
Sep 17, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
sbomer
reviewed
Sep 17, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a warning issue in trim tools where IL2042 warnings were incorrectly generated when backing fields of auto properties couldn't be found, particularly in illink->ilc scenarios when auto properties were stubbed out. Instead of warning, the tools now simply skip propagating the DAM annotation when the backing field cannot be located.
Key Changes
- Remove IL2042 warning generation when backing fields of auto properties cannot be found
- Simplify backing field detection logic to silently handle missing fields
- Update Roslyn analyzer to only check for auto properties when field has an associated property
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| PropertyDataFlow.cs | Remove expected IL2042 warnings from test cases since these warnings are no longer generated |
| FlowAnnotations.cs (illink) | Simplify backing field logic to skip warning when field not found and only propagate annotation when valid backing field exists |
| DiagnosticId.cs | Mark IL2042 diagnostic ID as unused by prefixing with "unused_" |
| FlowAnnotations.cs (analyzer) | Optimize property checking by combining auto property check with property symbol check |
| FlowAnnotations.cs (ilcompiler) | Apply same backing field logic simplification as illink version |
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
agocke
reviewed
Sep 18, 2025
agocke
reviewed
Sep 18, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
agocke
reviewed
Sep 18, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Show resolved
Hide resolved
sbomer
reviewed
Sep 18, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/FlowAnnotations.cs
Outdated
Show resolved
Hide resolved
…ere is a single valid field
…uster/runtime into AutoPropBackingFieldNoWarn
4 tasks
…uster/runtime into AutoPropBackingFieldNoWarn
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 was referenced Sep 19, 2025
Open
Member
|
/ba-g unknown failures were crashes in the infra |
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.
Fixes #119780
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.