Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OriginalDefinition to get members of generic types #96648

Merged

Conversation

jtschuster
Copy link
Member

From #86633 (comment)

The open generic type is represented to us as NonErrorNamedTypeSymbol, but that reports to have 0 members. It seems we need to use the OriginalDefinition to get to the generic type definition which will report all members correctly.

Fixes #86633

@ghost ghost added the linkable-framework Issues associated with delivering a linker friendly framework label Jan 8, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jan 8, 2024
@ghost ghost assigned jtschuster Jan 8, 2024
@ghost
Copy link

ghost commented Jan 8, 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

From #86633 (comment)

The open generic type is represented to us as NonErrorNamedTypeSymbol, but that reports to have 0 members. It seems we need to use the OriginalDefinition to get to the generic type definition which will report all members correctly.

Fixes #86633

Author: jtschuster
Assignees: -
Labels:

linkable-framework

Milestone: -

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

Thanks!

@jtschuster jtschuster merged commit a68b34f into dotnet:main Jan 9, 2024
74 of 76 checks passed
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
Updates the Trim analyzer to use the INamedTypeSymbol.OriginalDefinition to enumerate the type's member to warn for accessing a member with RequiresUnreferencedCode via reflection.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 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.

Trim analyzer doesn't see members on open generic type
2 participants