Skip to content

[API Proposal]: Add attribute that instructs Reflection to hide target member #118903

@tmat

Description

@tmat

Background and motivation

Hot Reload needs to mark metadata entities with an attribute or flag that instructs Reflection to not return them when enumerating types or type members.

See #75154

API Proposal

namespace System.Runtime.CompilerServices;

[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
public sealed class MetadataUpdateDeletedAttribute : Attribute;

API Usage

Reflection would filter out all types and members marked with this attribute if any Hot Reload change has been applied to the containing module/type.

Alternative Designs

If we need to optimize more we could mark the deleted member with RTSpecialName flag and only look up the custom attribute for members with this flag.

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions