SuppressMessage Attribute Factory.
Remarks: Code Analysis Warnings for Managed Code by CheckId: https://docs.microsoft.com/en-us/visualstudio/code-quality/code-analysis-warnings-for-managed-code-by-checkid?view=vs-2019.
public static class SuppressMessageAttributeFactory
SuppressMessageAttribute CreateCodeAnalysisSuppression(int checkId, string justification)Summary: Creates a
System.Diagnostics.CodeAnalysis.SuppressMessageAttributefor a Code Analysis (CA) rule suppression.Parameters:
checkId- The numeric identifier of the CA rule to suppress (e.g., 1062 for CA1062).
justification- The justification for suppressing the rule. If null or empty, defaults to "OK.".Returns: A
System.Diagnostics.CodeAnalysis.SuppressMessageAttributeconfigured for the specified rule. Well-known rules receive their canonical category and human-readable title; unknown rules receive a generic "Microsoft.Design" category and the bare rule id, which is sufficient for the analyzer match (matching is on rule id only, not on category).
SuppressMessageAttribute CreateStyleCopSuppression(int checkId, string justification)Summary: Creates a
System.Diagnostics.CodeAnalysis.SuppressMessageAttributefor a StyleCop (SA) rule suppression.Parameters:
checkId- The numeric identifier of the SA rule to suppress (e.g., 1413 for SA1413).
justification- The justification for suppressing the rule. If null or empty, defaults to "OK.".Returns: A
System.Diagnostics.CodeAnalysis.SuppressMessageAttributeconfigured for the specified rule. Well-known rules receive their canonical category and human-readable title; unknown rules receive a generic "StyleCop.CSharp.MaintainabilityRules" category and the bare rule id.