镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add SuppressLinkerWarningAttribute #35339

Closed

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; }
    }
}

Activity

  1. added this to the 5.0 milestone on Apr 23, 2020
  2. MichalStrehovsky commented on Apr 23, 2020

    @MichalStrehovsky
    MemberAuthor
  3. terrajobst commented on Apr 23, 2020

    @terrajobst
    Contributor

    Video

    • We should position it as a peer to SuppressMessageAttribute, UnconditionalSuppressMessageAttribute
    • It should be System.Diagnostics.CodeAnalysis
    • The behavior is the same, except it's not marked [Conditonal] and thus will always remain in metadata
    • We considered establishing an inheritance relationshop with SuppressMessageAttribute but concluded we don't need it (neither for docs nor for consumption)
    namespace System.Diagnostics.CodeAnalysis
    {
        [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
        public sealed class UnconditionalSuppressMessageAttribute : Attribute
        {
        	// Same API as SuppressMessageAttribute
        }
    }
  4. self-assigned this
    on Apr 23, 2020
  5. eerhardt commented on Apr 28, 2020

    @eerhardt
    Member

    Closed in #35387.

  6. ghost locked as resolved and limited conversation to collaborators on Dec 9, 2020
  7. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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