Skip to content

Add SuppressLinkerWarningAttribute #35339

@MichalStrehovsky

Description

@MichalStrehovsky

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

We need a way to selectively suppress warnings about linker-unfriendly patterns.

This attribute is largely inspired by SuppressMessageAttribute (that unfortunately cannot be used because it's marked [Conditional] under a condition that we wouldn't expect to enable when the linker runs).

namespace System.Runtime.CompilerServices
{
    [AttributeUsage(
     AttributeTargets.All,
     Inherited = false,
     AllowMultiple = true
     )
    ]
    public sealed class SuppressLinkerWarningAttribute : Attribute
    {
        public SuppressLinkerWarningAttribute(string category, string checkId)
        {
            Category = category;
            CheckId = checkId;
        }

        public string Category { get; }
        public string CheckId { get; }
        public string? MessageId { get; set; }
        public string? Justification { get; set; }
    }
}

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Runtimelinkable-frameworkIssues associated with delivering a linker friendly framework

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions