Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SuppressLinkerWarningAttribute #35339

Closed
MichalStrehovsky opened this issue Apr 23, 2020 · 3 comments
Closed

Add SuppressLinkerWarningAttribute #35339

MichalStrehovsky opened this issue Apr 23, 2020 · 3 comments
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Runtime linkable-framework Issues associated with delivering a linker friendly framework
Milestone

Comments

@MichalStrehovsky
Copy link
Member

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; }
    }
}
@MichalStrehovsky MichalStrehovsky added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 23, 2020
@MichalStrehovsky MichalStrehovsky added this to the 5.0 milestone Apr 23, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Runtime untriaged New issue has not been triaged by the area owner labels Apr 23, 2020
@MichalStrehovsky
Copy link
Member Author

Cc @vitek-karas

@terrajobst terrajobst added api-approved API was approved in API review, it can be implemented area-System.Runtime and removed area-System.Runtime labels Apr 23, 2020
@terrajobst
Copy link
Member

terrajobst commented Apr 23, 2020

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

@eerhardt eerhardt self-assigned this Apr 23, 2020
eerhardt added a commit to eerhardt/runtime that referenced this issue Apr 24, 2020
DynamicallyAccessedMembersAttribute
DynamicDependencyAttribute
UnconditionalSuppressMessageAttribute

Fix dotnet#33861, dotnet#35339, dotnet#30902
eerhardt added a commit that referenced this issue Apr 28, 2020
* Add new attributes for ILLink analysis.

DynamicallyAccessedMembersAttribute
DynamicDependencyAttribute
UnconditionalSuppressMessageAttribute

Fix #33861, #35339, #30902
@eerhardt
Copy link
Member

Closed in #35387.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
@tannergooding tannergooding removed the untriaged New issue has not been triaged by the area owner label Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Runtime linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

No branches or pull requests

5 participants