Skip to content

Conversation

@jtschuster
Copy link
Member

@jtschuster jtschuster commented Sep 18, 2025

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

  • Customer reported
  • Found internally

Regression

  • Yes
  • No

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.

Copilot AI review requested due to automatic review settings September 18, 2025 18:22
@github-actions github-actions bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Sep 18, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Sep 18, 2025
Copy link
Contributor

Copilot AI left a 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

Copy link
Member

@JulieLeeMSFT JulieLeeMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
CC @jeffschwMSFT.

@JulieLeeMSFT JulieLeeMSFT added the Servicing-approved Approved for servicing release label Sep 18, 2025
@JulieLeeMSFT JulieLeeMSFT added this to the 10.0.0 milestone Sep 18, 2025
@agocke agocke merged commit d48349d into dotnet:release/10.0 Sep 19, 2025
117 of 118 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants