warning restore IDE0051 public int PublicMethod() => UsedMethod(); } class C2 { // Necessary SuppressMessage attribute suppression [SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "<Pending>")] private int _unusedField; // IDE0079: Unnecessary SuppressMessage attribute suppression [SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification
Invalid target '~F:N.C.F2' - no matching field named 'F2' [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage Target = "~F:N.C.F2")] // IDE0076: Invalid scope 'property' [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage Scope = "property", Target = "~P:N.C.P")] // Fixed code [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage Category", "Id: Title", Scope = "member", Target = "~F:N.C.F")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage
#F' [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "Id: Title", Scope = "member #F")] // Fixed code [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "Id: Title
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2200:Rethrow to preserve stack details", [assembly: SuppressMessage("Usage", "CA2200:Rethrow to preserve stack details", Justification = "Not 例如,下面的代码将抑制针对编译器发出的构造函数的冲突: [module: SuppressMessage("Design", "CA1055:AbstractTypesDoNotHavePublicConstructors
Current { get { return _instance; } } [SuppressMessage null : HttpContext.Server; } } [System.Diagnostics.CodeAnalysis.SuppressMessage values); return true; } return false; } [SuppressMessage { get; private set; } [System.Diagnostics.CodeAnalysis.SuppressMessage Writer = null; } } [System.Diagnostics.CodeAnalysis.SuppressMessage
lock (root) { _q.Enqueue(value); } } [SuppressMessage root) { return _q.GetEnumerator(); } } [SuppressMessage
. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance
timeout, false); } [System.Security.SecuritySafeCritical] // auto-generated [SuppressMessage
// ReSharper disable once AssertEqualToInstanceOfType [SuppressMessage("ReSharper", "AssertEqualToInstanceOfType
System.ServiceProcess; namespace RedisService { class Program { [System.Diagnostics.CodeAnalysis.SuppressMessage
例如: [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( "WinForms.Analyzers", "WFO1000 例如: [System.Diagnostics.CodeAnalysis.SuppressMessage( "WinForms.Analyzers", "WFO1000", Justification
AppBarProcessor", typeof(AppBarWindowProcessor), typeof(DesktopAppBar), new PropertyMetadata(null)); [SuppressMessage
IntPtr hWnd, int nIndex); [DllImport("user32.dll", EntryPoint = "GetClassLongPtr")] [SuppressMessage