Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Aug 14, 2025

Fixes #106796

Copilot AI review requested due to automatic review settings August 14, 2025 22:50
@sbomer sbomer requested a review from marek-safar as a code owner August 14, 2025 22:50
@github-actions github-actions bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Aug 14, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 14, 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 adds trim analysis for implicit constructors to address issue #106796. The change ensures that when a class inherits from another class with RequiresUnreferencedCode annotations, the analyzer properly detects and warns about the implicit constructor call to the base class constructor.

Key changes:

  • Enhanced the RequiresUnreferencedCodeAnalyzer to analyze implicit base constructor calls
  • Added test case updates to verify the new analysis behavior with expected warnings

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
RequiresUnreferencedCodeAnalyzer.cs Added analysis logic for implicit base constructor calls in derived classes
RequiresOnClass.cs Added expected warnings and instantiation calls for test consistency between analyzer and trimmer
RequiresExcludeStatics.cs Added expected warning for implicit base constructor call

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/illink
See info in area-owners.md if you want to be subscribed.

@sbomer sbomer requested a review from a team August 15, 2025 21:36
@sbomer sbomer enabled auto-merge (squash) August 15, 2025 21:58
@jtschuster
Copy link
Member

/ba-g failures are unrelated

@sbomer sbomer merged commit 39aec19 into dotnet:main Aug 18, 2025
105 of 107 checks passed
@jtschuster
Copy link
Member

@sbomer I assume you were hoping to get this into 10?

@sbomer
Copy link
Member Author

sbomer commented Aug 18, 2025

/backport to release/10.0-rc1

@github-actions
Copy link
Contributor

Started backporting to release/10.0-rc1: https://github.com/dotnet/runtime/actions/runs/17047926123

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim analyzer misses base constructors with trim annotations

2 participants