Skip to content

Add RequiresUnreferencedCodeAttribute #33862

@MichalStrehovsky

Description

@MichalStrehovsky

This is in support of dotnet/linker#988 - see the spec there for motivation.

Potentially might want to call this something like RequiresFormFactorAttribute with a FormFactor enum. We'll want similar attributes to mark things that are unfriendly to AOT or unfriendly to single-file deployments.

namespace System.Runtime.CompilerServices
{
    [AttributeUsage(
        AttributeTargets.Method |
        AttributeTargets.Class |
        AttributeTargets.Struct |
        AttributeTargets.Constructor |
        AttributeTargets.Assembly)]
    public sealed class RequiresUnreferencedCodeAttribute : Attribute
    {
        public RequiresUnreferencedCodeAttribute(string message)
        {
            Message = message;
        }

        public string Message { get; }
    }
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions