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

ILLink keeps members of pointer/byref types for DynamicallyAccessedMembers #106214

Closed
sbomer opened this issue Aug 9, 2024 · 2 comments · Fixed by #106215
Closed

ILLink keeps members of pointer/byref types for DynamicallyAccessedMembers #106214

sbomer opened this issue Aug 9, 2024 · 2 comments · Fixed by #106215
Assignees
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@sbomer
Copy link
Member

sbomer commented Aug 9, 2024

var type = Type.GetType ("ElementType&, test");
RequireConstructor(type); // IL2026

[RequiresUnreferencedCode("ElementType")]
class ElementType {}

static void RequireConstructor([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type type) { }

This warns for reflection access to the ElementType constructor, even though the byref type has no constructor. NativeAot doesn't produce this warning.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Aug 9, 2024
Copy link
Contributor

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

@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Aug 9, 2024
@steveharter steveharter added this to the 9.0.0 milestone Aug 10, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Aug 10, 2024
@sbomer sbomer added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Aug 12, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@sbomer sbomer modified the milestones: 9.0.0, 10.0.0 Aug 13, 2024
sbomer added a commit that referenced this issue Aug 20, 2024
Adds tests from #106209. This
includes test coverage for
#95118 and
#106214.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 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 in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants