Skip to content

Comments

Detect static default interface methods in illink#96821

Merged
sbomer merged 2 commits intodotnet:mainfrom
sbomer:staticDefaultInterfaceMethods
Jan 11, 2024
Merged

Detect static default interface methods in illink#96821
sbomer merged 2 commits intodotnet:mainfrom
sbomer:staticDefaultInterfaceMethods

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Jan 10, 2024

Fixes #96516. The issue was that we were skipping the TypeMapInfo logic that would have been needed to discover static default interface implementations.

While investigating this I noticed more problems in this area (I will file bugs) that I plan to fix separately. For example, the current logic only works for instantiated types, so if you replace struct Derived in this testcase with a class, it fails.

@sbomer sbomer requested a review from marek-safar as a code owner January 10, 2024 23:32
@ghost ghost added linkable-framework Issues associated with delivering a linker friendly framework area-Tools-ILLink .NET linker development as well as trimming analyzers labels Jan 10, 2024
@ghost ghost assigned sbomer Jan 10, 2024
@sbomer sbomer requested a review from jtschuster January 10, 2024 23:32
@ghost
Copy link

ghost commented Jan 10, 2024

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #96516. The issue was that we were skipping the TypeMapInfo logic that would have been needed to discover static default interface implementations.

While investigating this I noticed more problems in this area (I will file bugs) that I plan to fix separately. For example, the current logic only works for instantiated types, so if you replace struct Derived in this testcase with a class, it fails.

Author: sbomer
Assignees: -
Labels:

linkable-framework

Milestone: -

Copy link
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.

Better mark too many methods than too few methods. LGTM.

I double checked that my advice to add the IsStatic check in #93662 did not in fact cause this regression bug - the previous IsNewSlot check was already filtering statics on its own since Roslyn doesn't mark static virtuals newslot. That PR is scheduled for servicing so it would by annoying if it was a regression.

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

Nice - thanks a lot.

Copy link
Member

@jtschuster jtschuster left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@sbomer sbomer merged commit 33446fb into dotnet:main Jan 11, 2024
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
* Detect static default interface methods in illink
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2024
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.

Trimmed winforms app crashes

4 participants