Skip to content

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

Closed

Description

@sbomer
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.

Activity

  1. added
    untriaged
    on Aug 9, 2024
  2. dotnet-policy-service commented on Aug 9, 2024

    @dotnet-policy-service
    Contributor

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

  3. added
    in-pr
    on Aug 9, 2024
  4. added this to the 9.0.0 milestone on Aug 10, 2024
  5. removed
    untriaged
    on Aug 10, 2024
  6. added
    area-Tools-ILLink
    on Aug 12, 2024
  7. dotnet-policy-service commented on Aug 12, 2024

    @dotnet-policy-service
    Contributor

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

  8. modified the milestones: 9.0.0, 10.0.0 on Aug 13, 2024
  9. locked and limited conversation to collaborators on Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-Tools-ILLinkin-pr

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions