Remove stale SuppressMessage attributes (dotnet/coreclr#26501)
authorStephen Toub <stoub@microsoft.com>
Fri, 6 Sep 2019 13:08:45 +0000 (09:08 -0400)
committerGitHub <noreply@github.com>
Fri, 6 Sep 2019 13:08:45 +0000 (09:08 -0400)
Commit migrated from https://github.com/dotnet/coreclr/commit/94f6badbea1eb09104041bba01273b4a39a2d4a2

13 files changed:
src/libraries/System.Private.CoreLib/src/System/Collections/ArrayList.cs
src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/Winmeta.cs
src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs
src/libraries/System.Private.CoreLib/src/System/LocalDataStoreSlot.cs
src/libraries/System.Private.CoreLib/src/System/Object.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/StrongBox.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/ConstrainedExecution/CriticalFinalizerObject.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.cs

index 53c7d79..71965b3 100644 (file)
@@ -904,7 +904,6 @@ namespace System.Collections
                 return _list.IndexOf(value);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex)
             {
                 return IndexOf(value, startIndex, _list.Count - startIndex);
@@ -970,13 +969,11 @@ namespace System.Collections
                 return LastIndexOf(value, _list.Count - 1, _list.Count);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex)
             {
                 return LastIndexOf(value, startIndex, startIndex + 1);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex, int count)
             {
                 if (_list.Count == 0)
@@ -1216,7 +1213,6 @@ namespace System.Collections
                         return _list.Capacity;
                     }
                 }
-                [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
                 set
                 {
                     lock (_root)
@@ -1290,7 +1286,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
             {
                 lock (_root)
@@ -1339,7 +1334,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void CopyTo(int index, Array array, int arrayIndex, int count)
             {
                 lock (_root)
@@ -1356,7 +1350,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override IEnumerator GetEnumerator(int index, int count)
             {
                 lock (_root)
@@ -1373,7 +1366,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex)
             {
                 lock (_root)
@@ -1382,7 +1374,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex, int count)
             {
                 lock (_root)
@@ -1399,7 +1390,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void InsertRange(int index, ICollection c)
             {
                 lock (_root)
@@ -1416,7 +1406,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex)
             {
                 lock (_root)
@@ -1425,7 +1414,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex, int count)
             {
                 lock (_root)
@@ -1450,7 +1438,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void RemoveRange(int index, int count)
             {
                 lock (_root)
@@ -1459,7 +1446,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Reverse(int index, int count)
             {
                 lock (_root)
@@ -1468,7 +1454,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void SetRange(int index, ICollection c)
             {
                 lock (_root)
@@ -1477,7 +1462,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override ArrayList GetRange(int index, int count)
             {
                 lock (_root)
@@ -1502,7 +1486,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Sort(int index, int count, IComparer? comparer)
             {
                 lock (_root)
@@ -1519,7 +1502,6 @@ namespace System.Collections
                 }
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override Array ToArray(Type type)
             {
                 lock (_root)
@@ -1766,7 +1748,6 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
             {
                 return _list.BinarySearch(index, count, value, comparer);
@@ -1775,7 +1756,6 @@ namespace System.Collections
             public override int Capacity
             {
                 get => _list.Capacity;
-                [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
                 set => throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
             }
 
@@ -1801,7 +1781,6 @@ namespace System.Collections
                 _list.CopyTo(array, index);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void CopyTo(int index, Array array, int arrayIndex, int count)
             {
                 _list.CopyTo(index, array, arrayIndex, count);
@@ -1812,7 +1791,6 @@ namespace System.Collections
                 return _list.GetEnumerator();
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override IEnumerator GetEnumerator(int index, int count)
             {
                 return _list.GetEnumerator(index, count);
@@ -1823,13 +1801,11 @@ namespace System.Collections
                 return _list.IndexOf(value);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex)
             {
                 return _list.IndexOf(value, startIndex);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex, int count)
             {
                 return _list.IndexOf(value, startIndex, count);
@@ -1840,7 +1816,6 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void InsertRange(int index, ICollection c)
             {
                 throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
@@ -1851,13 +1826,11 @@ namespace System.Collections
                 return _list.LastIndexOf(value);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex)
             {
                 return _list.LastIndexOf(value, startIndex);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex, int count)
             {
                 return _list.LastIndexOf(value, startIndex, count);
@@ -1873,13 +1846,11 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void RemoveRange(int index, int count)
             {
                 throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void SetRange(int index, ICollection c)
             {
                 _list.SetRange(index, c);
@@ -1896,14 +1867,12 @@ namespace System.Collections
                 return new Range(this, index, count);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Reverse(int index, int count)
             {
                 _list.Reverse(index, count);
                 _version = _list._version;
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Sort(int index, int count, IComparer? comparer)
             {
                 _list.Sort(index, count, comparer);
@@ -1915,7 +1884,6 @@ namespace System.Collections
                 return _list.ToArray();
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override Array ToArray(Type type)
             {
                 return _list.ToArray(type);
@@ -2033,7 +2001,6 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
             {
                 return _list.BinarySearch(index, count, value, comparer);
@@ -2043,7 +2010,6 @@ namespace System.Collections
             public override int Capacity
             {
                 get => _list.Capacity;
-                [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
                 set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
@@ -2069,7 +2035,6 @@ namespace System.Collections
                 _list.CopyTo(array, index);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void CopyTo(int index, Array array, int arrayIndex, int count)
             {
                 _list.CopyTo(index, array, arrayIndex, count);
@@ -2080,7 +2045,6 @@ namespace System.Collections
                 return _list.GetEnumerator();
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override IEnumerator GetEnumerator(int index, int count)
             {
                 return _list.GetEnumerator(index, count);
@@ -2091,13 +2055,11 @@ namespace System.Collections
                 return _list.IndexOf(value);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex)
             {
                 return _list.IndexOf(value, startIndex);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int IndexOf(object? value, int startIndex, int count)
             {
                 return _list.IndexOf(value, startIndex, count);
@@ -2108,7 +2070,6 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void InsertRange(int index, ICollection c)
             {
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
@@ -2119,13 +2080,11 @@ namespace System.Collections
                 return _list.LastIndexOf(value);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex)
             {
                 return _list.LastIndexOf(value, startIndex);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex, int count)
             {
                 return _list.LastIndexOf(value, startIndex, count);
@@ -2141,13 +2100,11 @@ namespace System.Collections
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void RemoveRange(int index, int count)
             {
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void SetRange(int index, ICollection c)
             {
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
@@ -2163,13 +2120,11 @@ namespace System.Collections
                 return new Range(this, index, count);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Reverse(int index, int count)
             {
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void Sort(int index, int count, IComparer? comparer)
             {
                 throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
@@ -2180,7 +2135,6 @@ namespace System.Collections
                 return _list.ToArray();
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override Array ToArray(Type type)
             {
                 return _list.ToArray(type);
@@ -2521,13 +2475,11 @@ namespace System.Collections
                 return -1;
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex)
             {
                 return LastIndexOf(value, startIndex, startIndex + 1);
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int LastIndexOf(object? value, int startIndex, int count)
             {
                 InternalUpdateRange();
@@ -2586,7 +2538,6 @@ namespace System.Collections
                 InternalUpdateVersion();
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override void SetRange(int index, ICollection c)
             {
                 InternalUpdateRange();
index 428464c..66e8c75 100644 (file)
@@ -12,8 +12,6 @@ namespace System.ComponentModel
     /// <summary>
     /// Specifies the default value for a property.
     /// </summary>
-    [SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
-    [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
     [AttributeUsage(AttributeTargets.All)]
     public class DefaultValueAttribute : Attribute
     {
index 6a3d373..41d6198 100644 (file)
@@ -100,7 +100,6 @@ namespace System.Diagnostics.Tracing
         private const int s_etwAPIMaxRefObjCount = 8;
         private const int s_traceEventMaximumSize = 65482;
 
-        [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
         public enum WriteEventErrorCode : int
         {
             // check mapping to runtime codes
@@ -684,7 +683,6 @@ namespace System.Diagnostics.Tracing
             return false;
         }
 
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
         public static WriteEventErrorCode GetLastWriteEventError()
         {
             return s_returnCode;
@@ -957,8 +955,6 @@ namespace System.Diagnostics.Tracing
         // <UsesUnsafeCode Name="Local v7 of type: Char*" />
         // <ReferencesCritical Name="Method: EncodeObject(Object&, EventData*, Byte*):String" Ring="1" />
         // </SecurityKernel>
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Performance-critical code")]
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
         internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, params object?[] eventPayload)
         {
             WriteEventErrorCode status = WriteEventErrorCode.NoError;
@@ -1155,7 +1151,6 @@ namespace System.Diagnostics.Tracing
         // <SecurityKernel Critical="True" Ring="0">
         // <CallsSuppressUnmanagedCode Name="Interop.Advapi32.EventWrite(System.Int64,EventDescriptor&,System.UInt32,System.Void*):System.UInt32" />
         // </SecurityKernel>
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
         protected internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data)
         {
             if (childActivityID != null)
@@ -1177,7 +1172,6 @@ namespace System.Diagnostics.Tracing
             return true;
         }
 
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
         internal unsafe bool WriteEventRaw(
             ref EventDescriptor eventDescriptor,
             IntPtr eventHandle,
index 4783935..cfd2173 100644 (file)
@@ -248,7 +248,6 @@ namespace System.Diagnostics.Tracing
         /// Returns true if the eventSource has been enabled at all. This is the preferred test
         /// to be performed before a relatively expensive EventSource operation.
         /// </summary>
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         public bool IsEnabled()
         {
             return m_eventSourceEnabled;
@@ -263,7 +262,6 @@ namespace System.Diagnostics.Tracing
         /// positives (but is always accurate when returning false).  EventSources are free to
         /// have additional filtering.
         /// </summary>
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         public bool IsEnabled(EventLevel level, EventKeywords keywords)
         {
             return IsEnabled(level, keywords, EventChannel.None);
@@ -279,7 +277,6 @@ namespace System.Diagnostics.Tracing
         /// positives (but is always accurate when returning false).  EventSources are free to
         /// have additional filtering.
         /// </summary>
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         public bool IsEnabled(EventLevel level, EventKeywords keywords, EventChannel channel)
         {
             if (!m_eventSourceEnabled)
@@ -743,14 +740,12 @@ namespace System.Diagnostics.Tracing
 
 #pragma warning disable 1591
         // optimized for common signatures (no args)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId)
         {
             WriteEventCore(eventId, 0, null);
         }
 
         // optimized for common signatures (ints)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, int arg1)
         {
             if (m_eventSourceEnabled)
@@ -763,7 +758,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, int arg1, int arg2)
         {
             if (m_eventSourceEnabled)
@@ -779,7 +773,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3)
         {
             if (m_eventSourceEnabled)
@@ -799,7 +792,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (longs)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, long arg1)
         {
             if (m_eventSourceEnabled)
@@ -812,7 +804,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, long arg1, long arg2)
         {
             if (m_eventSourceEnabled)
@@ -828,7 +819,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, long arg1, long arg2, long arg3)
         {
             if (m_eventSourceEnabled)
@@ -848,7 +838,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (strings)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1)
         {
             if (m_eventSourceEnabled)
@@ -865,7 +854,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2)
         {
             if (m_eventSourceEnabled)
@@ -887,7 +875,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3)
         {
             if (m_eventSourceEnabled)
@@ -915,7 +902,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (string and ints)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1, int arg2)
         {
             if (m_eventSourceEnabled)
@@ -935,7 +921,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3)
         {
             if (m_eventSourceEnabled)
@@ -959,7 +944,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (string and longs)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, string? arg1, long arg2)
         {
             if (m_eventSourceEnabled)
@@ -980,7 +964,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (long and string)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, long arg1, string? arg2)
         {
             if (m_eventSourceEnabled)
@@ -1001,7 +984,6 @@ namespace System.Diagnostics.Tracing
         }
 
         // optimized for common signatures (int and string)
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, int arg1, string? arg2)
         {
             if (m_eventSourceEnabled)
@@ -1021,7 +1003,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, byte[]? arg1)
         {
             if (m_eventSourceEnabled)
@@ -1055,7 +1036,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, long arg1, byte[]? arg2)
         {
             if (m_eventSourceEnabled)
@@ -1305,7 +1285,6 @@ namespace System.Diagnostics.Tracing
         /// method signature. Even if you use this for rare events, this call should be guarded by an <see cref="IsEnabled()"/>
         /// check so that the varargs call is not made when the EventSource is not active.
         /// </summary>
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         protected unsafe void WriteEvent(int eventId, params object?[] args)
         {
             WriteEventVarargs(eventId, null, args);
@@ -1442,7 +1421,6 @@ namespace System.Diagnostics.Tracing
         /// "Log", such an exception would become a cached exception for the initialization of the static
         /// member, and any future access to the "Log" would throw the cached exception).
         /// </summary>
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "guid")]
         private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, string[]? traits)
         {
             try
@@ -2178,7 +2156,6 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         private unsafe void WriteEventString(EventLevel level, long keywords, string msgString)
         {
 #if FEATURE_MANAGED_ETW
@@ -3706,7 +3683,6 @@ namespace System.Diagnostics.Tracing
         /// </summary>
         /// <param name="method">The method to probe.</param>
         /// <returns>The literal value or -1 if the value could not be determined. </returns>
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Switch statement is clearer than alternatives")]
         private static int GetHelperCallFirstArg(MethodInfo method)
         {
 #if (!ES_BUILD_PCL && !ES_BUILD_PN)
@@ -3835,7 +3811,6 @@ namespace System.Diagnostics.Tracing
         /// It will do this even if the EventSource is not enabled.
         /// TODO remove flush parameter it is not used.
         /// </summary>
-        [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
         internal void ReportOutOfBandMessage(string msg, bool flush)
         {
             try
@@ -4083,7 +4058,6 @@ namespace System.Diagnostics.Tracing
         /// call Dispose when they are done with their logging.
         /// </summary>
 #if ES_BUILD_STANDALONE
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
 #endif
         public virtual void Dispose()
         {
index a230f54..03d86f8 100644 (file)
@@ -117,7 +117,6 @@ namespace System.Diagnostics.Tracing
     /// <summary>
     /// EventChannel. Custom values must be in the range from 16 through 255. Currently only predefined values allowed.
     /// </summary>
-    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification = "Backwards compatibility")]
     public enum EventChannel : byte
     {
         /// <summary>
index 9db4769..393d224 100644 (file)
@@ -1330,7 +1330,6 @@ namespace System.IO
                 return -1;
             }
 
-            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
             public override int Read(char[] buffer, int index, int count)
             {
                 return 0;
index 6464878..592b817 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+using System.Diagnostics.CodeAnalysis;
 using System.Threading;
 
 namespace System
@@ -16,7 +17,7 @@ namespace System
 
         internal ThreadLocal<object?> Data { get; private set; }
 
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer preserved for compat, it is suppressed by the constructor.")]
+        [SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer preserved for compat, it is suppressed by the constructor.")]
         ~LocalDataStoreSlot()
         {
         }
index 376bb55..a8e12bc 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+using System.Diagnostics.CodeAnalysis;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Runtime.Versioning;
@@ -28,7 +29,7 @@ namespace System
         // Allow an object to free resources before the object is reclaimed by the GC.
         // This method's virtual slot number is hardcoded in runtimes. Do not add any virtual methods ahead of this.
         [NonVersionable]
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
+        [SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
         ~Object()
         {
         }
index 02a21c3..bdee518 100644 (file)
@@ -16,7 +16,6 @@ namespace System.Runtime.CompilerServices
         /// Gets the strongly typed value associated with the <see cref = "StrongBox{T}"></see>
         /// <remarks>This is explicitly exposed as a field instead of a property to enable loading the address of the field.</remarks>
         /// </summary>
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
         [MaybeNull] public T Value = default!;
 
         /// <summary>
index 0f22b03..a6e07b8 100644 (file)
@@ -12,6 +12,8 @@
 **
 ===========================================================*/
 
+using System.Diagnostics.CodeAnalysis;
+
 namespace System.Runtime.ConstrainedExecution
 {
     public abstract class CriticalFinalizerObject
@@ -20,7 +22,7 @@ namespace System.Runtime.ConstrainedExecution
         {
         }
 
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
+        [SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
         ~CriticalFinalizerObject()
         {
         }
index 234446c..c9f8766 100644 (file)
@@ -23,7 +23,6 @@ namespace System.Runtime.InteropServices
         //   manipulating _state.
 
         /// <summary>Specifies the handle to be wrapped.</summary>
-        [SuppressMessage("Microsoft.Security", "CA2111:PointersShouldNotBeVisible")]
         protected IntPtr handle;
         /// <summary>Combined ref count and closed/disposed flags (so we can atomically modify them).</summary>
         private volatile int _state;
index dd8a36e..1389949 100644 (file)
@@ -246,20 +246,15 @@ namespace System.Threading.Tasks
 
         /// <summary>Gets the number of tasks waiting to run concurrently.</summary>
         /// <remarks>This does not take the necessary lock, as it's only called from under the debugger.</remarks>
-        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
         private int ConcurrentTaskCountForDebugger => m_concurrentTaskScheduler.m_tasks.Count;
 
         /// <summary>Gets the number of tasks waiting to run exclusively.</summary>
         /// <remarks>This does not take the necessary lock, as it's only called from under the debugger.</remarks>
-        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
         private int ExclusiveTaskCountForDebugger => m_exclusiveTaskScheduler.m_tasks.Count;
 
         /// <summary>Notifies the pair that new work has arrived to be processed.</summary>
         /// <param name="fairly">Whether tasks should be scheduled fairly with regards to other tasks.</param>
         /// <remarks>Must only be called while holding the lock.</remarks>
-        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
-        [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals")]
-        [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
         private void ProcessAsyncIfNecessary(bool fairly = false)
         {
             ContractAssertMonitorStatus(ValueLock, held: true);
@@ -467,7 +462,6 @@ namespace System.Threading.Tasks
         /// state in one of those conditions or if the user explicitly asks for
         /// the Completion.
         /// </summary>
-        [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
         private sealed class CompletionState : Task
         {
             /// <summary>Whether the scheduler has had completion requested.</summary>
@@ -622,7 +616,6 @@ namespace System.Threading.Tasks
             /// </summary>
             /// <param name="task">The task to execute inline if possible.</param>
             /// <returns>true if the task was inlined successfully; otherwise, false.</returns>
-            [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "ignored")]
             private bool TryExecuteTaskInlineOnTargetScheduler(Task task)
             {
                 // We'd like to simply call TryExecuteTaskInline here, but we can't.
@@ -669,7 +662,6 @@ namespace System.Threading.Tasks
             protected override IEnumerable<Task> GetScheduledTasks() { return m_tasks; }
 
             /// <summary>Gets the number of tasks queued to this scheduler.</summary>
-            [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
             private int CountForDebugger => m_tasks.Count;
 
             /// <summary>Provides a debug view for ConcurrentExclusiveTaskScheduler.</summary>
index 8ab07b7..8f99a52 100644 (file)
@@ -212,7 +212,6 @@ namespace System.Threading
                 }
             }
 
-            [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
             public bool LocalFindAndPop(object obj)
             {
                 // Fast path: check the tail. If equal, we can skip the lock.
@@ -271,7 +270,6 @@ namespace System.Threading
 
             public object? LocalPop() => m_headIndex < m_tailIndex ? LocalPopCore() : null;
 
-            [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
             private object? LocalPopCore()
             {
                 while (true)