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

Suppressing analyzer diagnostics in IDE should generate a GlobalSuppresions.cs file using UnconditionalSuppressMessage #2251

Open
mateoatr opened this issue Sep 2, 2021 · 0 comments
Milestone

Comments

@mateoatr
Copy link
Contributor

mateoatr commented Sep 2, 2021

Currently, if a user chooses to suppress the diagnostics produced by the trimmer analyzer and clicks on the option given by the IDE, a global suppressions file will be generated with a list of assembly-level SuppressMessage attributes. However, this does not work for the diagnostics generated by the trimmer analyzer, since these must be unconditionally suppressed, otherwise the trimmer will keep emitting warnings when publishing. We should look into generating a global suppressions file that uses UnconditionalSuppressMessage instead.

Example of the GlobalSuppressions.cs file that is today generated:

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Trimming", "IL2026:Methods annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants