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>")]
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
SuppressMessageattributes. 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 usesUnconditionalSuppressMessageinstead.Example of the GlobalSuppressions.cs file that is today generated: