Skip to content

Deduplicate warnings for attribute on property dataflow#127254

Merged
eduardo-vp merged 5 commits intodotnet:mainfrom
eduardo-vp:ilc-dup-warning-2
Apr 28, 2026
Merged

Deduplicate warnings for attribute on property dataflow#127254
eduardo-vp merged 5 commits intodotnet:mainfrom
eduardo-vp:ilc-dup-warning-2

Conversation

@eduardo-vp
Copy link
Copy Markdown
Member

@eduardo-vp eduardo-vp commented Apr 22, 2026

Adding PropertyMetadataNode and EventMetadataNode to the dependency graph to remove duplicate warnings caused by analyzing accessors (getter, setter) and events (adder, remover, raiser) more than once.

Fixes #120004.

Copilot AI review requested due to automatic review settings April 22, 2026 00:31
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 22, 2026
Copy link
Copy Markdown
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 fixes NativeAOT duplicate trim-analysis warnings emitted when analyzing custom attributes on properties/events (dataflow/capability warnings), aligning NativeAOT behavior with the analyzer/ILLink and addressing #120004.

Changes:

  • Add a deduplication mechanism in the NativeAOT metadata manager to ensure property/event custom attributes are analyzed only once per metadata handle.
  • Update NativeAOT linker/analyzer test cases by removing UnexpectedWarning annotations that were tracking the duplicate-warning bug.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnAttribute.cs Removes NativeAOT-only UnexpectedWarning entries now that warnings should not be duplicated.
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs Removes NativeAOT-only UnexpectedWarning entries for attribute-on-property/event dataflow scenarios.
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs Tracks processed property/event custom attribute handles to support deduplication.
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs Uses the new tracking to skip re-analyzing the same property/event custom attributes (and re-emitting the same diagnostics).

@eduardo-vp
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@eduardo-vp
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Looks great!

…nalysis/MethodMetadataNode.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 04:50
Copy link
Copy Markdown
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.

Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.

@eduardo-vp
Copy link
Copy Markdown
Member Author

/ba-g DeadLetter

@eduardo-vp eduardo-vp merged commit 3effa1e into dotnet:main Apr 28, 2026
129 of 132 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-NativeAOT-coreclr linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ILC: Duplicate warnings for attribute on property dataflow

3 participants