diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-08-01 02:10:59 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-08-03 21:55:40 +0300 |
commit | 3385433b606d47cdb623b93a1672e18a7fda7410 (patch) | |
tree | 093a309f80d3d232525e8c5cc061636945c69909 /netcore | |
parent | 3fde98da3e5c910ec9f72760f595a864636fd142 (diff) |
Enable several StyleCopAnalyzers (dotnet/corefx#39921)
* Fix ordering of keywords in member signatures
* Add StyeCop.Analyzers
Most rules are disabled. Many of them we'll want to leave disabled, however there are a handful it'll be good to enable over time.
* Use built-in type alias
* Fix straggling stylecop warnings in all configurations
* Replace tabs with spaces
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'netcore')
35 files changed, 55 insertions, 55 deletions
diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs index 90286b27be6..034373c0af0 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs @@ -9,7 +9,7 @@ internal partial class Interop internal partial class Advapi32 { [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static unsafe extern int EventSetInformation( + internal static extern unsafe int EventSetInformation( long registrationHandle, EVENT_INFO_CLASS informationClass, void* eventInformation, diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs index 0e7c3cc6451..f7627dfaaa1 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs @@ -47,7 +47,7 @@ internal partial class Interop } [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true)] - internal static unsafe extern int EnumerateTraceGuidsEx( + internal static extern unsafe int EnumerateTraceGuidsEx( TRACE_QUERY_INFO_CLASS TraceQueryInfoClass, void* InBuffer, int InBufferSize, diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs index 2d3f45e839b..07c10ab35b0 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs @@ -38,7 +38,7 @@ internal partial class Interop } [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, EntryPoint = "EventWriteTransfer")] - private static unsafe extern int EventWriteTransfer_PInvoke( + private static extern unsafe int EventWriteTransfer_PInvoke( long registrationHandle, in EventDescriptor eventDescriptor, Guid* activityId, diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs index 067ee715870..8c1566bb586 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs @@ -10,6 +10,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern Interop.BOOL FileTimeToSystemTime(long* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime); + internal static extern unsafe Interop.BOOL FileTimeToSystemTime(long* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessInformation.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessInformation.cs index 22e05693754..5894e2c89b4 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessInformation.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessInformation.cs @@ -18,6 +18,6 @@ internal partial class Interop } [DllImport(Libraries.Kernel32)] - internal static unsafe extern Interop.BOOL GetProcessInformation(IntPtr hProcess, int ProcessInformationClass, void* ProcessInformation, int ProcessInformationSize); + internal static extern unsafe Interop.BOOL GetProcessInformation(IntPtr hProcess, int ProcessInformationClass, void* ProcessInformation, int ProcessInformationSize); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs index 710db5e4b99..9a2a784d326 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs @@ -10,6 +10,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime); + internal static extern unsafe void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs index e2dcd906c2a..68132fbf341 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs @@ -10,6 +10,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern void GetSystemTimeAsFileTime(long* lpSystemTimeAsFileTime); + internal static extern unsafe void GetSystemTimeAsFileTime(long* lpSystemTimeAsFileTime); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs index e3262799d13..6a9439875c3 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs @@ -10,6 +10,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern void GetSystemTimePreciseAsFileTime(long* lpSystemTimeAsFileTime); + internal static extern unsafe void GetSystemTimePreciseAsFileTime(long* lpSystemTimeAsFileTime); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs index 43db7b47164..7ee2f7bee3d 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs @@ -9,6 +9,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, long* lpFileTime); + internal static extern unsafe Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, long* lpFileTime); } } diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs index 2cca7faed73..36f3e083dcb 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs @@ -10,7 +10,7 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32)] - internal static unsafe extern Interop.BOOL TzSpecificLocalTimeToSystemTime( + internal static extern unsafe Interop.BOOL TzSpecificLocalTimeToSystemTime( IntPtr lpTimeZoneInformation, Interop.Kernel32.SYSTEMTIME* lpLocalTime, Interop.Kernel32.SYSTEMTIME* lpUniversalTime); diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs index 16f05e338cd..3c4b72cd1c4 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs @@ -10,7 +10,7 @@ internal partial class Interop internal partial class NtDll { [DllImport(Libraries.NtDll)] - internal static unsafe extern int NtQuerySystemInformation(int SystemInformationClass, void* SystemInformation, int SystemInformationLength, uint* ReturnLength); + internal static extern unsafe int NtQuerySystemInformation(int SystemInformationClass, void* SystemInformation, int SystemInformationLength, uint* ReturnLength); [StructLayout(LayoutKind.Sequential)] internal struct SYSTEM_LEAP_SECOND_INFORMATION diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs index 078ebd481dd..52e391c018a 100644 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs +++ b/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs @@ -10,6 +10,6 @@ internal partial class Interop internal partial class User32 { [DllImport(Libraries.User32, SetLastError = true, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode)] - internal static unsafe extern int LoadString(SafeLibraryHandle hInstance, uint uID, char* lpBuffer, int cchBufferMax); + internal static extern unsafe int LoadString(SafeLibraryHandle hInstance, uint uID, char* lpBuffer, int cchBufferMax); } } diff --git a/netcore/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/netcore/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs index 3be2e354abf..e768b35f1ed 100644 --- a/netcore/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs +++ b/netcore/System.Private.CoreLib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs @@ -4,7 +4,7 @@ namespace Microsoft.Win32.SafeHandles { - sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid + internal sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeLibraryHandle() : base(true) { } diff --git a/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPool.cs b/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPool.cs index 5e01399a333..73d3d7f5a3c 100644 --- a/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPool.cs +++ b/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPool.cs @@ -21,7 +21,7 @@ namespace System.Buffers { // Store the shared ArrayPool in a field of its derived sealed type so the Jit can "see" the exact type // when the Shared property is inlined which will allow it to devirtualize calls made on it. - private readonly static TlsOverPerCoreLockedStacksArrayPool<T> s_shared = new TlsOverPerCoreLockedStacksArrayPool<T>(); + private static readonly TlsOverPerCoreLockedStacksArrayPool<T> s_shared = new TlsOverPerCoreLockedStacksArrayPool<T>(); /// <summary> /// Retrieves a shared <see cref="ArrayPool{T}"/> instance. diff --git a/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPoolEventSource.cs b/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPoolEventSource.cs index d0563c4977d..f4cfe549c94 100644 --- a/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPoolEventSource.cs +++ b/netcore/System.Private.CoreLib/shared/System/Buffers/ArrayPoolEventSource.cs @@ -9,7 +9,7 @@ namespace System.Buffers [EventSource(Guid = "0866B2B8-5CEF-5DB9-2612-0C0FFD814A44", Name = "System.Buffers.ArrayPoolEventSource")] internal sealed class ArrayPoolEventSource : EventSource { - internal readonly static ArrayPoolEventSource Log = new ArrayPoolEventSource(); + internal static readonly ArrayPoolEventSource Log = new ArrayPoolEventSource(); /// <summary>The reason for a BufferAllocated event.</summary> internal enum BufferAllocatedReason : int diff --git a/netcore/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs b/netcore/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs index 27cb176a1a8..734a7774d47 100644 --- a/netcore/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs +++ b/netcore/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs @@ -47,9 +47,9 @@ namespace System.Buffers.Text Number.NumberBuffer number = new Number.NumberBuffer(Number.NumberBufferKind.Decimal, pDigits, Number.DecimalNumberBufferLength); Number.DecimalToNumber(ref value, ref number); - if (number.Digits[0] == 0) - { - number.IsNegative = false; // For Decimals, -0 must print as normal 0. + if (number.Digits[0] == 0) + { + number.IsNegative = false; // For Decimals, -0 must print as normal 0. } bool success = TryFormatDecimalG(ref number, destination, out bytesWritten); #if DEBUG diff --git a/netcore/System.Private.CoreLib/shared/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs b/netcore/System.Private.CoreLib/shared/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs index 7369ed8ca6f..2412ecac648 100644 --- a/netcore/System.Private.CoreLib/shared/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs +++ b/netcore/System.Private.CoreLib/shared/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs @@ -50,7 +50,7 @@ namespace System.Buffers private int _callbackCreated; - private readonly static bool s_trimBuffers = GetTrimBuffers(); + private static readonly bool s_trimBuffers = GetTrimBuffers(); /// <summary> /// Used to keep track of all thread local buckets for trimming if needed diff --git a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs index f3d4dbce352..ceaf125338c 100644 --- a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs +++ b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs @@ -41,7 +41,7 @@ namespace System.Diagnostics.Tracing #endif struct EventDescriptor { - # region private + #region private [FieldOffset(0)] private int m_traceloggingId; [FieldOffset(0)] diff --git a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs index 8b1770d87a3..23a1b014464 100644 --- a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs +++ b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventProvider.cs @@ -1165,7 +1165,7 @@ namespace System.Diagnostics.Tracing // <CallsSuppressUnmanagedCode Name="Interop.Advapi32.EventWrite(System.Int64,EventDescriptor&,System.UInt32,System.Void*):System.UInt32" /> // </SecurityKernel> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] - internal protected unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data) + protected internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data) { if (childActivityID != null) { 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 329e0e640f8..ea05b9d68a8 100644 --- a/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/netcore/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -4236,7 +4236,7 @@ namespace System.Diagnostics.Tracing /// for a particular eventSource to occur BEFORE the OnEventSourceCreated is issued. /// </summary> /// <param name="eventSource"></param> - internal protected virtual void OnEventSourceCreated(EventSource eventSource) + protected internal virtual void OnEventSourceCreated(EventSource eventSource) { EventHandler<EventSourceCreatedEventArgs>? callBack = this._EventSourceCreated; if (callBack != null) @@ -4252,7 +4252,7 @@ namespace System.Diagnostics.Tracing /// the EventListener has enabled events. /// </summary> /// <param name="eventData"></param> - internal protected virtual void OnEventWritten(EventWrittenEventArgs eventData) + protected internal virtual void OnEventWritten(EventWrittenEventArgs eventData) { EventHandler<EventWrittenEventArgs>? callBack = this.EventWritten; if (callBack != null) diff --git a/netcore/System.Private.CoreLib/shared/System/Environment.Win32.cs b/netcore/System.Private.CoreLib/shared/System/Environment.Win32.cs index 37213f0d76e..1ea246164be 100644 --- a/netcore/System.Private.CoreLib/shared/System/Environment.Win32.cs +++ b/netcore/System.Private.CoreLib/shared/System/Environment.Win32.cs @@ -424,8 +424,8 @@ namespace System // Seperate type so a .cctor is not created for Enviroment which then would be triggered during startup private static class WindowsVersion { - // Cache the value in readonly static that can be optimized out by the JIT - internal readonly static bool IsWindows8OrAbove = GetIsWindows8OrAbove(); + // Cache the value in static readonly that can be optimized out by the JIT + internal static readonly bool IsWindows8OrAbove = GetIsWindows8OrAbove(); private static bool GetIsWindows8OrAbove() { diff --git a/netcore/System.Private.CoreLib/shared/System/EnvironmentVariableTarget.cs b/netcore/System.Private.CoreLib/shared/System/EnvironmentVariableTarget.cs index a592832ce59..581c4aa30b1 100644 --- a/netcore/System.Private.CoreLib/shared/System/EnvironmentVariableTarget.cs +++ b/netcore/System.Private.CoreLib/shared/System/EnvironmentVariableTarget.cs @@ -5,12 +5,12 @@ namespace System { #if PROJECTN - [Internal.Runtime.CompilerServices.RelocatedType("System.Runtime.Extensions")] + [Internal.Runtime.CompilerServices.RelocatedType("System.Runtime.Extensions")] #endif - public enum EnvironmentVariableTarget - { - Process = 0, - User = 1, - Machine = 2, - } + public enum EnvironmentVariableTarget + { + Process = 0, + User = 1, + Machine = 2, + } } diff --git a/netcore/System.Private.CoreLib/shared/System/Globalization/CultureInfo.Windows.cs b/netcore/System.Private.CoreLib/shared/System/Globalization/CultureInfo.Windows.cs index 775ee4ee9dd..444e6541897 100644 --- a/netcore/System.Private.CoreLib/shared/System/Globalization/CultureInfo.Windows.cs +++ b/netcore/System.Private.CoreLib/shared/System/Globalization/CultureInfo.Windows.cs @@ -39,7 +39,7 @@ namespace System.Globalization return GetCultureByName(strDefault); } - private unsafe static CultureInfo GetUserDefaultUICulture() + private static unsafe CultureInfo GetUserDefaultUICulture() { #if !ENABLE_WINRT if (GlobalizationMode.Invariant) 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 976e072b2b1..9cb515ae88a 100644 --- a/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs +++ b/netcore/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs @@ -1477,7 +1477,7 @@ namespace System.IO private sealed unsafe class AsyncCopyToAwaitable : ICriticalNotifyCompletion { /// <summary>Sentinel object used to indicate that the I/O operation has completed before being awaited.</summary> - private readonly static Action s_sentinel = () => { }; + private static readonly Action s_sentinel = () => { }; /// <summary>Cached delegate to IOCallback.</summary> internal static readonly IOCompletionCallback s_callback = IOCallback; diff --git a/netcore/System.Private.CoreLib/shared/System/Lazy.cs b/netcore/System.Private.CoreLib/shared/System/Lazy.cs index b341136e8af..2a90f1da880 100644 --- a/netcore/System.Private.CoreLib/shared/System/Lazy.cs +++ b/netcore/System.Private.CoreLib/shared/System/Lazy.cs @@ -43,11 +43,11 @@ namespace System /// </summary> internal class LazyHelper { - internal readonly static LazyHelper NoneViaConstructor = new LazyHelper(LazyState.NoneViaConstructor); - internal readonly static LazyHelper NoneViaFactory = new LazyHelper(LazyState.NoneViaFactory); - internal readonly static LazyHelper PublicationOnlyViaConstructor = new LazyHelper(LazyState.PublicationOnlyViaConstructor); - internal readonly static LazyHelper PublicationOnlyViaFactory = new LazyHelper(LazyState.PublicationOnlyViaFactory); - internal readonly static LazyHelper PublicationOnlyWaitForOtherThreadToPublish = new LazyHelper(LazyState.PublicationOnlyWait); + internal static readonly LazyHelper NoneViaConstructor = new LazyHelper(LazyState.NoneViaConstructor); + internal static readonly LazyHelper NoneViaFactory = new LazyHelper(LazyState.NoneViaFactory); + internal static readonly LazyHelper PublicationOnlyViaConstructor = new LazyHelper(LazyState.PublicationOnlyViaConstructor); + internal static readonly LazyHelper PublicationOnlyViaFactory = new LazyHelper(LazyState.PublicationOnlyViaFactory); + internal static readonly LazyHelper PublicationOnlyWaitForOtherThreadToPublish = new LazyHelper(LazyState.PublicationOnlyWait); internal LazyState State { get; } diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs index b1e3e323242..1658a4bf854 100644 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs +++ b/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs @@ -15,8 +15,8 @@ namespace System.Reflection { public abstract partial class Assembly : ICustomAttributeProvider, ISerializable { - private readonly static Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>(); - private readonly static List<string> s_loadFromAssemblyList = new List<string>(); + private static readonly Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>(); + private static readonly List<string> s_loadFromAssemblyList = new List<string>(); private static bool s_loadFromHandlerSet; private static int s_cachedSerializationSwitch; diff --git a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs index 97c0535e3cc..3af525e6f0f 100644 --- a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs +++ b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs @@ -315,7 +315,7 @@ namespace System.Runtime.CompilerServices { #if !PROJECTN /// <summary>A cached task for default(TResult).</summary> - internal readonly static Task<TResult> s_defaultResultTask = AsyncTaskCache.CreateCacheableTask<TResult>(default); + internal static readonly Task<TResult> s_defaultResultTask = AsyncTaskCache.CreateCacheableTask<TResult>(default); #endif /// <summary>The lazily-initialized built task.</summary> @@ -935,12 +935,12 @@ namespace System.Runtime.CompilerServices // All static members are initialized inline to ensure type is beforefieldinit /// <summary>A cached Task{Boolean}.Result == true.</summary> - internal readonly static Task<bool> TrueTask = CreateCacheableTask(true); + internal static readonly Task<bool> TrueTask = CreateCacheableTask(true); /// <summary>A cached Task{Boolean}.Result == false.</summary> - internal readonly static Task<bool> FalseTask = CreateCacheableTask(false); + internal static readonly Task<bool> FalseTask = CreateCacheableTask(false); /// <summary>The cache of Task{Int32}.</summary> - internal readonly static Task<int>[] Int32Tasks = CreateInt32Tasks(); + internal static readonly Task<int>[] Int32Tasks = CreateInt32Tasks(); /// <summary>The minimum value, inclusive, for which we want a cached task.</summary> internal const int INCLUSIVE_INT32_MIN = -1; /// <summary>The maximum value, exclusive, for which we want a cached task.</summary> diff --git a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/MethodImplAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/MethodImplAttribute.cs index 8e8f93c268d..18900b37bea 100644 --- a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/MethodImplAttribute.cs +++ b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/MethodImplAttribute.cs @@ -6,7 +6,7 @@ namespace System.Runtime.CompilerServices { // Custom attribute to specify additional method properties. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)] - sealed public class MethodImplAttribute : Attribute + public sealed class MethodImplAttribute : Attribute { public MethodCodeType MethodCodeType; diff --git a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs index f049c89b3f3..b1f274367e8 100644 --- a/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs +++ b/netcore/System.Private.CoreLib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs @@ -5,7 +5,7 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Struct)] - sealed public class UnsafeValueTypeAttribute : Attribute + public sealed class UnsafeValueTypeAttribute : Attribute { } } diff --git a/netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/Marshal.cs b/netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/Marshal.cs index 705dd95e2a7..c5e43524567 100644 --- a/netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/Marshal.cs +++ b/netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/Marshal.cs @@ -924,7 +924,7 @@ namespace System.Runtime.InteropServices FreeBSTR(s); } - public unsafe static void ZeroFreeCoTaskMemAnsi(IntPtr s) + public static unsafe void ZeroFreeCoTaskMemAnsi(IntPtr s) { ZeroFreeCoTaskMemUTF8(s); } @@ -949,7 +949,7 @@ namespace System.Runtime.InteropServices FreeCoTaskMem(s); } - public unsafe static void ZeroFreeGlobalAllocAnsi(IntPtr s) + public static unsafe void ZeroFreeGlobalAllocAnsi(IntPtr s) { if (s == IntPtr.Zero) { diff --git a/netcore/System.Private.CoreLib/shared/System/SpanHelpers.T.cs b/netcore/System.Private.CoreLib/shared/System/SpanHelpers.T.cs index 46afe190222..7419bb0c9d0 100644 --- a/netcore/System.Private.CoreLib/shared/System/SpanHelpers.T.cs +++ b/netcore/System.Private.CoreLib/shared/System/SpanHelpers.T.cs @@ -52,7 +52,7 @@ namespace System } // Adapted from IndexOf(...) - public unsafe static bool Contains<T>(ref T searchSpace, T value, int length) + public static unsafe bool Contains<T>(ref T searchSpace, T value, int length) #nullable disable // to enable use with both T and T? for reference types due to IEquatable<T> being invariant where T : IEquatable<T> #nullable restore diff --git a/netcore/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.cs b/netcore/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.cs index 5c8a40906bd..4c97d8538a8 100644 --- a/netcore/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.cs +++ b/netcore/System.Private.CoreLib/shared/System/Text/Unicode/Utf8Utility.cs @@ -32,7 +32,7 @@ namespace System.Text.Unicode /// comes first) is ASCII. /// </summary> [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe static int GetIndexOfFirstInvalidUtf8Sequence(ReadOnlySpan<byte> utf8Data, out bool isAscii) + public static unsafe int GetIndexOfFirstInvalidUtf8Sequence(ReadOnlySpan<byte> utf8Data, out bool isAscii) { fixed (byte* pUtf8Data = &MemoryMarshal.GetReference(utf8Data)) { diff --git a/netcore/System.Private.CoreLib/shared/System/Threading/CancellationToken.cs b/netcore/System.Private.CoreLib/shared/System/Threading/CancellationToken.cs index 42d54f61ab7..fc95945fef3 100644 --- a/netcore/System.Private.CoreLib/shared/System/Threading/CancellationToken.cs +++ b/netcore/System.Private.CoreLib/shared/System/Threading/CancellationToken.cs @@ -36,7 +36,7 @@ namespace System.Threading private readonly CancellationTokenSource? _source; //!! warning. If more fields are added, the assumptions in CreateLinkedToken may no longer be valid - private readonly static Action<object?> s_actionToActionObjShunt = obj => + private static readonly Action<object?> s_actionToActionObjShunt = obj => { Debug.Assert(obj is Action, $"Expected {typeof(Action)}, got {obj}"); ((Action)obj)(); diff --git a/netcore/System.Private.CoreLib/shared/System/Threading/SemaphoreSlim.cs b/netcore/System.Private.CoreLib/shared/System/Threading/SemaphoreSlim.cs index be0f9112c44..15ede7ec2a1 100644 --- a/netcore/System.Private.CoreLib/shared/System/Threading/SemaphoreSlim.cs +++ b/netcore/System.Private.CoreLib/shared/System/Threading/SemaphoreSlim.cs @@ -66,7 +66,7 @@ namespace System.Threading private static readonly Task<bool> s_trueTask = new Task<bool>(false, true, (TaskCreationOptions)InternalTaskOptions.DoNotDispose, default); // A pre-completed task with Result==false - private readonly static Task<bool> s_falseTask = + private static readonly Task<bool> s_falseTask = new Task<bool>(false, false, (TaskCreationOptions)InternalTaskOptions.DoNotDispose, default); // No maximum constant diff --git a/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs b/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs index f275fd95491..91ee4b853d1 100644 --- a/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs +++ b/netcore/System.Private.CoreLib/shared/System/Threading/Tasks/TaskContinuation.cs @@ -663,12 +663,12 @@ namespace System.Threading.Tasks } /// <summary>Cached delegate that invokes an Action passed as an object parameter.</summary> - private readonly static ContextCallback s_invokeContextCallback = (state) => + private static readonly ContextCallback s_invokeContextCallback = (state) => { Debug.Assert(state is Action); ((Action)state)(); }; - private readonly static Action<Action> s_invokeAction = (action) => action(); + private static readonly Action<Action> s_invokeAction = (action) => action(); [MethodImpl(MethodImplOptions.AggressiveInlining)] protected static ContextCallback GetInvokeActionCallback() => s_invokeContextCallback; |