diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-08-08 22:25:14 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-08-09 17:23:42 +0300 |
commit | 86a0ad2f8885df2795c9d10ee363a6db48998507 (patch) | |
tree | 93c632b5dde327f497e0dd49601b4f57748f9911 /netcore | |
parent | f39ac1d32d357b30253fc713155547f39256fe83 (diff) |
Fix FxCop warning CA1823 (unused fields)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'netcore')
14 files changed, 8 insertions, 100 deletions
diff --git a/netcore/System.Private.CoreLib/shared/System/AccessViolationException.cs b/netcore/System.Private.CoreLib/shared/System/AccessViolationException.cs index 11590028d5a..f19b3c4ed76 100644 --- a/netcore/System.Private.CoreLib/shared/System/AccessViolationException.cs +++ b/netcore/System.Private.CoreLib/shared/System/AccessViolationException.cs @@ -43,9 +43,11 @@ namespace System } #pragma warning disable 169 // Field is not used from managed. +#pragma warning disable CA1823 private IntPtr _ip; // Address of faulting instruction. private IntPtr _target; // Address that could not be accessed. private int _accessType; // 0:read, 1:write +#pragma warning restore CA1823 #pragma warning restore 169 } } diff --git a/netcore/System.Private.CoreLib/shared/System/ByReference.cs b/netcore/System.Private.CoreLib/shared/System/ByReference.cs index b9df09a6cdd..196b53c04b1 100644 --- a/netcore/System.Private.CoreLib/shared/System/ByReference.cs +++ b/netcore/System.Private.CoreLib/shared/System/ByReference.cs @@ -15,8 +15,10 @@ namespace System { // CS0169: The private field '{blah}' is never used #pragma warning disable 169 +#pragma warning disable CA1823 private readonly IntPtr _value; -#pragma warning restore +#pragma warning disable CA1823 +#pragma warning restore 169 [Intrinsic] public ByReference(ref T value) diff --git a/netcore/System.Private.CoreLib/shared/System/Convert.cs b/netcore/System.Private.CoreLib/shared/System/Convert.cs index fefb569aad9..8616cd94605 100644 --- a/netcore/System.Private.CoreLib/shared/System/Convert.cs +++ b/netcore/System.Private.CoreLib/shared/System/Convert.cs @@ -136,8 +136,7 @@ namespace System private const int base64LineBreakPosition = 76; #if DEBUG - private static bool TriggerAsserts = DoAsserts(); - private static bool DoAsserts() + static Convert() { Debug.Assert(ConvertTypes != null, "[Convert.cctor]ConvertTypes!=null"); Debug.Assert(ConvertTypes.Length == ((int)TypeCode.String + 1), "[Convert.cctor]ConvertTypes.Length == ((int)TypeCode.String + 1)"); @@ -147,7 +146,6 @@ namespace System "[Convert.cctor]ConvertTypes[(int)TypeCode.String]==typeof(System.String)"); Debug.Assert(ConvertTypes[(int)TypeCode.Int32] == typeof(int), "[Convert.cctor]ConvertTypes[(int)TypeCode.Int32]==typeof(int)"); - return true; } #endif diff --git a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs index a0fe6447370..4dcd725ca70 100644 --- a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -241,7 +241,9 @@ namespace System.Diagnostics.Tracing { #if FEATURE_EVENTSOURCE_XPLAT +#pragma warning disable CA1823 // field is used to keep listener alive private static readonly EventListener? persistent_Xplat_Listener = XplatEventLogger.InitializePersistentListener(); +#pragma warning restore SA1617 #endif //FEATURE_EVENTSOURCE_XPLAT /// <summary> diff --git a/netcore/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Windows.cs b/netcore/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Windows.cs index 7f1ba8ca917..67c9cdcaf06 100644 --- a/netcore/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Windows.cs +++ b/netcore/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Windows.cs @@ -431,7 +431,6 @@ namespace System.Globalization private IntPtr _sortHandle; private const uint LCMAP_SORTKEY = 0x00000400; - private const uint LCMAP_HASH = 0x00040000; private const int FIND_STARTSWITH = 0x00100000; private const int FIND_ENDSWITH = 0x00200000; diff --git a/netcore/System.Private.CoreLib/shared/System/Globalization/DateTimeFormatInfo.cs b/netcore/System.Private.CoreLib/shared/System/Globalization/DateTimeFormatInfo.cs index db644420357..a0afc8f76c0 100644 --- a/netcore/System.Private.CoreLib/shared/System/Globalization/DateTimeFormatInfo.cs +++ b/netcore/System.Private.CoreLib/shared/System/Globalization/DateTimeFormatInfo.cs @@ -1306,10 +1306,6 @@ namespace System.Globalization } } - // Whitespaces that we allow in the month names. - // U+00a0 is non-breaking space. - private static readonly char[] s_monthSpaces = { ' ', '\u00a0' }; - internal bool HasSpacesInMonthNames =>(FormatFlags & DateTimeFormatFlags.UseSpacesInMonthNames) != 0; internal bool HasSpacesInDayNames => (FormatFlags & DateTimeFormatFlags.UseSpacesInDayNames) != 0; diff --git a/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs b/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs index 4811ea50dc9..2f6c636dace 100644 --- a/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs +++ b/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs @@ -1151,16 +1151,9 @@ namespace System.IO // Windows API definitions, from winbase.h and others - private const int FILE_ATTRIBUTE_NORMAL = 0x00000080; - private const int FILE_ATTRIBUTE_ENCRYPTED = 0x00004000; - private const int FILE_FLAG_OVERLAPPED = 0x40000000; internal const int GENERIC_READ = unchecked((int)0x80000000); private const int GENERIC_WRITE = 0x40000000; - private const int FILE_BEGIN = 0; - private const int FILE_CURRENT = 1; - private const int FILE_END = 2; - // Error codes (not HRESULTS), from winerror.h internal const int ERROR_BROKEN_PIPE = 109; internal const int ERROR_NO_DATA = 232; diff --git a/netcore/System.Private.CoreLib/shared/System/Number.Formatting.cs b/netcore/System.Private.CoreLib/shared/System/Number.Formatting.cs index 6047e9357ff..2d3c2228f69 100644 --- a/netcore/System.Private.CoreLib/shared/System/Number.Formatting.cs +++ b/netcore/System.Private.CoreLib/shared/System/Number.Formatting.cs @@ -261,8 +261,6 @@ namespace System private const int DefaultPrecisionExponentialFormat = 6; - private const int ScaleNAN = unchecked((int)0x80000000); - private const int ScaleINF = 0x7FFFFFFF; private const int MaxUInt32DecDigits = 10; private const int CharStackBufferSize = 32; private const string PosNumberFormat = "#"; diff --git a/netcore/System.Private.CoreLib/shared/System/Random.cs b/netcore/System.Private.CoreLib/shared/System/Random.cs index 5aa2f432b17..06ec46e5240 100644 --- a/netcore/System.Private.CoreLib/shared/System/Random.cs +++ b/netcore/System.Private.CoreLib/shared/System/Random.cs @@ -11,7 +11,6 @@ namespace System // private const int MBIG = int.MaxValue; private const int MSEED = 161803398; - private const int MZ = 0; // // Member Variables diff --git a/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs b/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs index 9dfe8247b0d..8965aefe678 100644 --- a/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs +++ b/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs @@ -30,7 +30,6 @@ namespace System.Security private const int AttributesTypical = 4 * 2; // 4 attributes, times 2 strings per attribute private const int ChildrenTypical = 1; - private const string Indent = " "; private static readonly char[] s_tagIllegalCharacters = new char[] { ' ', '<', '>' }; private static readonly char[] s_textIllegalCharacters = new char[] { '<', '>' }; diff --git a/netcore/System.Private.CoreLib/shared/System/Text/Encoding.cs b/netcore/System.Private.CoreLib/shared/System/Text/Encoding.cs index e19aa71852b..b91fcbae26c 100644 --- a/netcore/System.Private.CoreLib/shared/System/Text/Encoding.cs +++ b/netcore/System.Private.CoreLib/shared/System/Text/Encoding.cs @@ -97,55 +97,11 @@ namespace System.Text private const int CodePageNoSymbol = 42; // Symbol code page not supported private const int CodePageUnicode = 1200; // Unicode private const int CodePageBigEndian = 1201; // Big Endian Unicode - private const int CodePageWindows1252 = 1252; // Windows 1252 code page - - // 20936 has same code page as 10008, so we'll special case it - private const int CodePageMacGB2312 = 10008; - private const int CodePageGB2312 = 20936; - private const int CodePageMacKorean = 10003; - private const int CodePageDLLKorean = 20949; - - // ISO 2022 Code Pages - private const int ISO2022JP = 50220; - private const int ISO2022JPESC = 50221; - private const int ISO2022JPSISO = 50222; - private const int ISOKorean = 50225; - private const int ISOSimplifiedCN = 50227; - private const int EUCJP = 51932; - private const int ChineseHZ = 52936; // HZ has ~}~{~~ sequences - - // 51936 is the same as 936 - private const int DuplicateEUCCN = 51936; - private const int EUCCN = 936; - - private const int EUCKR = 51949; // Latin 1 & ASCII Code Pages internal const int CodePageASCII = 20127; // ASCII internal const int ISO_8859_1 = 28591; // Latin1 - // ISCII - private const int ISCIIAssemese = 57006; - private const int ISCIIBengali = 57003; - private const int ISCIIDevanagari = 57002; - private const int ISCIIGujarathi = 57010; - private const int ISCIIKannada = 57008; - private const int ISCIIMalayalam = 57009; - private const int ISCIIOriya = 57007; - private const int ISCIIPanjabi = 57011; - private const int ISCIITamil = 57004; - private const int ISCIITelugu = 57005; - - // GB18030 - private const int GB18030 = 54936; - - // Other - private const int ISO_8859_8I = 38598; - private const int ISO_8859_8_Visual = 28598; - - // 50229 is currently unsupported // "Chinese Traditional (ISO-2022)" - private const int ENC50229 = 50229; - // Special code pages private const int CodePageUTF7 = 65000; private const int CodePageUTF8 = 65001; diff --git a/netcore/System.Private.CoreLib/shared/System/Threading/ManualResetEventSlim.cs b/netcore/System.Private.CoreLib/shared/System/Threading/ManualResetEventSlim.cs index b9a1c095e90..bef1d582275 100644 --- a/netcore/System.Private.CoreLib/shared/System/Threading/ManualResetEventSlim.cs +++ b/netcore/System.Private.CoreLib/shared/System/Threading/ManualResetEventSlim.cs @@ -62,13 +62,6 @@ namespace System.Threading private const int NumWaitersState_MaxValue = (1 << 19) - 1; //512K-1 // ----------- // -#if DEBUG - private static int s_nextId; // The next id that will be given out. - private int m_id = Interlocked.Increment(ref s_nextId); // A unique id for debugging purposes only. - private long m_lastSetTime; - private long m_lastResetTime; -#endif - /// <summary> /// Gets the underlying <see cref="System.Threading.WaitHandle"/> object for this <see /// cref="ManualResetEventSlim"/>. @@ -346,10 +339,6 @@ namespace System.Threading } } } - -#if DEBUG - m_lastSetTime = DateTime.UtcNow.Ticks; -#endif } /// <summary> @@ -377,10 +366,6 @@ namespace System.Threading // And finally set our state back to unsignaled. IsSet = false; - -#if DEBUG - m_lastResetTime = DateTime.UtcNow.Ticks; -#endif } /// <summary> diff --git a/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TplEventSource.cs b/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TplEventSource.cs index 3a1d3148928..e8d1849b678 100644 --- a/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TplEventSource.cs +++ b/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TplEventSource.cs @@ -146,27 +146,11 @@ namespace System.Threading.Tasks public const EventKeywords DebugActivityId = (EventKeywords)0x40000; } - /// <summary>Enabled for all keywords.</summary> - private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1); - //----------------------------------------------------------------------------------- // // TPL Event IDs (must be unique) // - /// <summary>The beginning of a parallel loop.</summary> - private const int PARALLELLOOPBEGIN_ID = 1; - /// <summary>The ending of a parallel loop.</summary> - private const int PARALLELLOOPEND_ID = 2; - /// <summary>The beginning of a parallel invoke.</summary> - private const int PARALLELINVOKEBEGIN_ID = 3; - /// <summary>The ending of a parallel invoke.</summary> - private const int PARALLELINVOKEEND_ID = 4; - /// <summary>A task entering a fork/join construct.</summary> - private const int PARALLELFORK_ID = 5; - /// <summary>A task leaving a fork/join construct.</summary> - private const int PARALLELJOIN_ID = 6; - /// <summary>A task is scheduled to a task scheduler.</summary> private const int TASKSCHEDULED_ID = 7; /// <summary>A task is about to execute.</summary> diff --git a/netcore/System.Private.CoreLib/shared/System/TimeSpan.cs b/netcore/System.Private.CoreLib/shared/System/TimeSpan.cs index 6cd2ad7a16b..d093ff24637 100644 --- a/netcore/System.Private.CoreLib/shared/System/TimeSpan.cs +++ b/netcore/System.Private.CoreLib/shared/System/TimeSpan.cs @@ -42,11 +42,6 @@ namespace System public const long TicksPerDay = TicksPerHour * 24; // 864,000,000,000 private const double DaysPerTick = 1.0 / TicksPerDay; // 1.1574074074074074074e-12 - private const int MillisPerSecond = 1000; - private const int MillisPerMinute = MillisPerSecond * 60; // 60,000 - private const int MillisPerHour = MillisPerMinute * 60; // 3,600,000 - private const int MillisPerDay = MillisPerHour * 24; // 86,400,000 - internal const long MaxSeconds = long.MaxValue / TicksPerSecond; internal const long MinSeconds = long.MinValue / TicksPerSecond; |