More corelib cleanup (dotnet/coreclr#26993)
authorStephen Toub <stoub@microsoft.com>
Thu, 3 Oct 2019 19:28:18 +0000 (15:28 -0400)
committerGitHub <noreply@github.com>
Thu, 3 Oct 2019 19:28:18 +0000 (15:28 -0400)
* Make relevant types static (mostly Interop)

* Fix a few stray semicolons

* Remove unnecessary locals

Some can be removed entirely, some can be replaced by discards.

* Remove unnecessary usings

* Move Unix-specific helper method to TimeZoneInfo.Unix.cs

* Remove duplicated code

* Remove duplicative checks

* Remove [ThreadStatic] initialization

These are all the default values and wouldn't be necessary for any static, but inline initialization for [ThreadStatic]s is particularly unuseful (and in non-default cases problematic) because the fields are only set to these values on the initializing thread.

* Fix methods whose return value is never used

* Use string.IsNullOrEmpty

* Remove unnecessary field initialization

All ctors overwrite these values.

* Address PR feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/c203e048817b0a3233773cc52d79bf665f1bd8a4

169 files changed:
src/coreclr/src/System.Private.CoreLib/src/Interop/Windows/OleAut32/Interop.VariantClear.cs
src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSourceHelper.Unix.cs
src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSourceHelper.Windows.cs
src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
src/coreclr/src/System.Private.CoreLib/src/System/GC.cs
src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Windows.cs
src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Variant.cs
src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
src/coreclr/src/System.Private.CoreLib/src/System/Utf8Extensions.cs
src/libraries/System.Private.CoreLib/src/Interop/Unix/Interop.Errors.cs
src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.ActivityControl.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EVENT_INFO_CLASS.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EtwEnableCallback.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventActivityIdControl.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventRegister.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventSetInformation.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventUnregister.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventWriteString.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.LookupAccountNameW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegCloseKey.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegCreateKeyEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegDeleteKeyEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegDeleteValue.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegEnumValue.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegFlushKey.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegOpenKeyEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Advapi32/Interop.RegistryConstants.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/BCrypt/Interop.NTSTATUS.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Interop.BOOL.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Interop.BOOLEAN.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Interop.Errors.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.CancelIoEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.CloseHandle.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.CreateFile.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.CreateFile2.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FILE_INFO_BY_HANDLE_CLASS.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FILE_TIME.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FileAttributes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FileTypes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FindClose.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FormatMessage.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.FreeLibrary.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetCPInfo.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetComputerName.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetProcessInformation.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetProcessMemoryInfo.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetStdHandle.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetSystemTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetTempPathW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GetVersionExW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.HandleTypes.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.LocalAlloc.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.LockFile.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.MAX_PATH.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.OutputDebugString.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SecurityOptions.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.VirtualFree.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.VirtualQuery.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.WIN32_FIND_DATA.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Normaliz/Interop.Idna.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Normaliz/Interop.Normalization.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/OleAut32/Interop.SysFreeString.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/OleAut32/Interop.SysStringLen.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Secur32/Interop.GetUserNameExW.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/User32/Interop.Constants.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/User32/Interop.LoadString.cs
src/libraries/System.Private.CoreLib/src/Interop/Windows/User32/Interop.SendMessageTimeout.cs
src/libraries/System.Private.CoreLib/src/System/AttributeUsageAttribute.cs
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/Globalization/DateTimeFormat.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/GregorianCalendarHelper.cs
src/libraries/System.Private.CoreLib/src/System/IO/BinaryReader.cs
src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Unix.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Windows.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs
src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs
src/libraries/System.Private.CoreLib/src/System/Text/TrimType.cs
src/libraries/System.Private.CoreLib/src/System/Text/Unicode/Utf8Utility.WhiteSpace.cs
src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TplEventSource.cs
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs

index ae95fe5..d409ea6 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class OleAut32
+    internal static partial class OleAut32
     {
         [DllImport(Libraries.OleAut32)]
         internal static extern void VariantClear(IntPtr variant);
index 776ad5d..f5c4475 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 namespace System.Diagnostics.Tracing
 {
-    internal sealed class RuntimeEventSourceHelper
+    internal static class RuntimeEventSourceHelper
     {
         private static Interop.Sys.ProcessCpuInformation cpuInfo;
 
index 6a74c7f..2688c56 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace System.Diagnostics.Tracing
 {
-    internal sealed class RuntimeEventSourceHelper
+    internal static class RuntimeEventSourceHelper
     {
         private static long prevProcUserTime = 0;
         private static long prevProcKernelTime = 0;
index 68737c1..3c83ff6 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Diagnostics
         private static GetSourceLineInfoDelegate? s_getSourceLineInfo = null;
 
         [ThreadStatic]
-        private static int t_reentrancy = 0;
+        private static int t_reentrancy;
 
         public StackFrameHelper(Thread? target)
         {
index f1fd7fa..a01b73f 100644 (file)
@@ -505,7 +505,7 @@ namespace System
             return StartNoGCRegionWorker(totalSize, true, lohSize, disallowFullBlockingGC);
         }
 
-        private static EndNoGCRegionStatus EndNoGCRegionWorker()
+        public static void EndNoGCRegion()
         {
             EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion();
             if (status == EndNoGCRegionStatus.NotInProgress)
@@ -514,13 +514,6 @@ namespace System
                 throw new InvalidOperationException("Garbage collection was induced in NoGCRegion mode");
             else if (status == EndNoGCRegionStatus.AllocationExceeded)
                 throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");
-
-            return EndNoGCRegionStatus.Succeeded;
-        }
-
-        public static void EndNoGCRegion()
-        {
-            EndNoGCRegionWorker();
         }
 
         private readonly struct MemoryLoadChangeNotification
index 95a54fd..dccd60c 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace System.Globalization
 {
-    internal sealed partial class GlobalizationMode
+    internal static partial class GlobalizationMode
     {
         private static bool GetGlobalizationInvariantMode()
         {
index 2738d5b..f5def09 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace System.Globalization
 {
-    internal sealed partial class GlobalizationMode
+    internal static partial class GlobalizationMode
     {
         private static bool GetGlobalizationInvariantMode()
         {
index 924fb5f..7918880 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace System.Globalization
 {
-    internal sealed partial class GlobalizationMode
+    internal static partial class GlobalizationMode
     {
         internal static bool Invariant { get; } = GetGlobalizationInvariantMode();
 
index f4ec345..b21b5b1 100644 (file)
@@ -438,7 +438,7 @@ namespace System.Reflection.Emit
             // Transparent DynamicMethod to call the current DynamicMethod.
             //
 
-            RuntimeMethodHandle method = GetMethodDescriptor();
+            _ = GetMethodDescriptor();
             // ignore obj since it's a static method
 
             // create a signature object
index 43ae5c9..a66b6e6 100644 (file)
@@ -113,7 +113,7 @@ namespace System.Reflection.Emit
         private static Type? GetType(string strFormat, Type baseType)
         {
             // This function takes a string to describe the compound type, such as "[,][]", and a baseType.
-            if (strFormat == null || strFormat.Equals(string.Empty))
+            if (string.IsNullOrEmpty(strFormat))
             {
                 return baseType;
             }
index ae8e75f..ac78f5b 100644 (file)
@@ -258,7 +258,7 @@ namespace System.Reflection.Emit
                 runtimeType2 = t2;
             }
 
-            // If the type builder view is eqaul then it is equal
+            // If the type builder view is equal then it is equal
             if (tb1 != null && tb2 != null && object.ReferenceEquals(tb1, tb2))
                 return true;
 
@@ -1376,8 +1376,7 @@ namespace System.Reflection.Emit
 
                 // The signature grabbing code has to be up here or the signature won't be finished
                 // and our equals check won't work.
-                int sigLength;
-                byte[] sigBytes = method.GetMethodSignature().InternalGetSignature(out sigLength);
+                _ = method.GetMethodSignature().InternalGetSignature(out _);
 
                 if (m_listMethods.Contains(method))
                 {
index b0ba8bf..3052a5c 100644 (file)
@@ -42,7 +42,7 @@ namespace System.Reflection.Emit
         private Type m_type;
         private Type[] m_inst;
         private string? m_strFullQualName;
-        internal Hashtable m_hashtable = new Hashtable();
+        internal Hashtable m_hashtable;
 
         #endregion
 
index 3574c7f..9961a96 100644 (file)
@@ -327,9 +327,6 @@ namespace System.Reflection
         {
             INVOCATION_FLAGS invocationFlags = InvocationFlags;
 
-            // get the declaring TypeHandle early for consistent exceptions in IntrospectionOnly context
-            RuntimeTypeHandle declaringTypeHandle = m_declaringType.TypeHandle;
-
             if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE | INVOCATION_FLAGS.INVOCATION_FLAGS_CONTAINS_STACK_POINTERS | INVOCATION_FLAGS.INVOCATION_FLAGS_NO_CTOR_INVOKE)) != 0)
                 ThrowNoInvokeException();
 
index 34b8bc7..972042b 100644 (file)
@@ -291,23 +291,19 @@ namespace System.Reflection
         #endregion
 
         #region MethodBase Overrides
-        internal override ParameterInfo[] GetParametersNoCopy()
-        {
+        internal override ParameterInfo[] GetParametersNoCopy() =>
             FetchNonReturnParameters();
 
-            return m_parameters!;
-        }
-
         public override ParameterInfo[] GetParameters()
         {
-            FetchNonReturnParameters();
+            ParameterInfo[] parameters = FetchNonReturnParameters();
 
-            if (m_parameters!.Length == 0)
-                return m_parameters;
+            if (parameters.Length == 0)
+                return parameters;
 
-            ParameterInfo[] ret = new ParameterInfo[m_parameters.Length];
+            ParameterInfo[] ret = new ParameterInfo[parameters.Length];
 
-            Array.Copy(m_parameters, 0, ret, 0, m_parameters.Length);
+            Array.Copy(parameters, 0, ret, 0, parameters.Length);
 
             return ret;
         }
index 6f5c560..ebd7c2f 100644 (file)
@@ -293,8 +293,7 @@ namespace System.Runtime.InteropServices
                     || (vt == VarEnum.VT_UNKNOWN)
                     || (vt == VarEnum.VT_DISPATCH)
                     || (vt == VarEnum.VT_VARIANT)
-                    || (vt == VarEnum.VT_RECORD)
-                    || (vt == VarEnum.VT_VARIANT))
+                    || (vt == VarEnum.VT_RECORD))
             {
                 unsafe
                 {
index dc9eda2..824df63 100644 (file)
@@ -3512,7 +3512,6 @@ namespace System
             int argCnt = (providedArgs != null) ? providedArgs.Length : 0;
 
             binder ??= DefaultBinder;
-            bool bDefaultBinder = (binder == DefaultBinder);
 
             // Delegate to Activator.CreateInstance
             if ((bindingFlags & BindingFlags.CreateInstance) != 0)
index 85ee986..e6a9bc1 100644 (file)
@@ -6,7 +6,6 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Text;
 using System.Text.Unicode;
-using Internal.Runtime.CompilerServices;
 
 namespace System
 {
index 2bba204..943df86 100644 (file)
@@ -151,7 +151,7 @@ internal static partial class Interop
         }
     }
 
-    internal partial class Sys
+    internal static partial class Sys
     {
         internal static Error GetLastError()
         {
index e911b13..8585069 100644 (file)
@@ -6,7 +6,7 @@ using System;
 using System.Diagnostics;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
     internal unsafe partial class Sys
     {
index 27dce58..0937556 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         internal enum ActivityControl : uint
         {
index 36abdb4..fae4d2e 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         internal enum EVENT_INFO_CLASS
         {
index 6bb1575..33f6ae6 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         internal const int EVENT_CONTROL_CODE_DISABLE_PROVIDER = 0;
         internal const int EVENT_CONTROL_CODE_ENABLE_PROVIDER = 1;
index 886ff37..2d73e3e 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, ExactSpelling = true)]
         internal static extern int EventActivityIdControl(ActivityControl ControlCode, ref Guid ActivityId);
index f5d245e..1c1af36 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, ExactSpelling = true)]
         internal static extern unsafe uint EventRegister(
index 034373c..b3a8851 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, ExactSpelling = true)]
         internal static extern unsafe int EventSetInformation(
index f7627df..d85b2e5 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         internal enum TRACE_QUERY_INFO_CLASS
         {
index 3fb5a75..1943cb3 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, ExactSpelling = true)]
         internal static extern uint EventUnregister(long registrationHandle);
index 4ee30f6..9c60558 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, ExactSpelling = true)]
         internal static extern int EventWriteString(
index 774da37..1bc116f 100644 (file)
@@ -10,9 +10,9 @@ using Microsoft.Diagnostics.Tracing;
 using System.Diagnostics.Tracing;
 #endif
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         /// <summary>
         ///  Call the ETW native API EventWriteTransfer and checks for invalid argument error.
index 2aa5851..a254e69 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
         internal static extern bool LookupAccountNameW(
index 375376d..c4a6944 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32)]
         internal static extern int RegCloseKey(IntPtr hKey);
index d1471ee..bb9da06 100644 (file)
@@ -10,9 +10,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         // Note: RegCreateKeyEx won't set the last error on failure - it returns
         // an error code if it fails.
index ef74d49..487caf8 100644 (file)
@@ -9,9 +9,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegDeleteKeyExW")]
         internal static extern int RegDeleteKeyEx(SafeRegistryHandle hKey, string lpSubKey, int samDesired, int Reserved);
index 6b5af77..43cf683 100644 (file)
@@ -10,9 +10,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegDeleteValueW")]
         internal static extern int RegDeleteValue(SafeRegistryHandle hKey, string? lpValueName);
index 6d4b86e..11165cc 100644 (file)
@@ -10,9 +10,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegEnumKeyExW")]
         internal static extern unsafe int RegEnumKeyEx(
index 3d455d0..e2ab45d 100644 (file)
@@ -11,9 +11,9 @@ using Internal.Win32.SafeHandles;
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegEnumValueW")]
         internal static extern unsafe int RegEnumValue(
index fa56f48..ccbecb6 100644 (file)
@@ -9,9 +9,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32)]
         internal static extern int RegFlushKey(SafeRegistryHandle hKey);
index 32cbbfc..5f5b6b6 100644 (file)
@@ -11,9 +11,9 @@ using Internal.Win32.SafeHandles;
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegOpenKeyExW")]
         internal static extern int RegOpenKeyEx(
index 24eeb1f..c2bb82f 100644 (file)
@@ -12,9 +12,9 @@ using System;
 using System.Runtime.InteropServices;
 using System.Text;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryInfoKeyW")]
         internal static extern int RegQueryInfoKey(
index f224de6..72b8aa8 100644 (file)
@@ -10,9 +10,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")]
         internal static extern int RegQueryValueEx(
index 3082da7..847d28f 100644 (file)
@@ -10,9 +10,9 @@ using Internal.Win32.SafeHandles;
 #endif
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
index 9115f63..48ea1f2 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Advapi32
+    internal static partial class Advapi32
     {
         internal static class RegistryOptions
         {
index 7955dd7..1e6452f 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class BCrypt
+    internal static partial class BCrypt
     {
         internal const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002;
 
index e69a5ef..af646ae 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class BCrypt
+    internal static partial class BCrypt
     {
         internal enum NTSTATUS : uint
         {
index b85b5fc..84942d9 100644 (file)
@@ -5,9 +5,9 @@
 using System.Runtime.InteropServices;
 using System.Security;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Crypt32
+    internal static partial class Crypt32
     {
         internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16;
         internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0;
index 9f4dab8..b79d90f 100644 (file)
@@ -2,7 +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.
 
-internal partial class Interop
+internal static partial class Interop
 {
     /// <summary>
     /// Blittable version of Windows BOOL type. It is convenient in situations where
index 4874734..8158ffa 100644 (file)
@@ -2,7 +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.
 
-internal partial class Interop
+internal static partial class Interop
 {
     /// <summary>
     /// Blittable version of Windows BOOLEAN type. It is convenient in situations where
index 2e4683d..cb6125d 100644 (file)
@@ -2,10 +2,10 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
     // As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx
-    internal partial class Errors
+    internal static partial class Errors
     {
         internal const int ERROR_SUCCESS = 0x0;
         internal const int ERROR_FILE_NOT_FOUND = 0x2;
index 16365ee..eee8b84 100644 (file)
@@ -7,9 +7,9 @@ using System;
 using System.IO;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal unsafe struct CREATEFILE2_EXTENDED_PARAMETERS
         {
index 01b957f..75f160b 100644 (file)
@@ -5,9 +5,9 @@
 using System.Runtime.InteropServices;
 using System.Threading;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped);
index ff41f93..c438599 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool CloseHandle(IntPtr handle);
index 0e7519d..9ebac4f 100644 (file)
@@ -7,9 +7,9 @@ using System;
 using System.IO;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use CreateFile.
index 323de99..000b978 100644 (file)
@@ -7,9 +7,9 @@ using System.Diagnostics;
 using System.IO;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "CreateFile2", SetLastError = true, CharSet = CharSet.Unicode)]
         private static extern SafeFileHandle CreateFile2Private(
index ce3db6f..fbd5da8 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, SetLastError = true)]
         internal static extern uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize);
index 9295595..5ea23ea 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal enum FILE_INFO_BY_HANDLE_CLASS : uint
         {
index d3b055e..6a6464c 100644 (file)
@@ -4,9 +4,9 @@
 
 using System;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal struct FILE_TIME
         {
index 725a25a..2cf4e28 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal partial class FileAttributes
         {
index 6c87f65..676e344 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe Interop.BOOL FileTimeToSystemTime(long* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime);
index 9d52f1f..a23ba1a 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal partial class FileTypes
         {
index 8e48e62..4bd5349 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool FindClose(IntPtr hFindFile);
index 0033b25..6ab52b4 100644 (file)
@@ -8,9 +8,9 @@ using System;
 using System.IO;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use FindFirstFile.
index 03ac47d..2b145d3 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
index 09001e8..2eda58f 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
         private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800;
index c372a85..c222db8 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "FreeEnvironmentStringsW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern unsafe bool FreeEnvironmentStrings(char* lpszEnvironmentBlock);
index c708653..56d52fe 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
         internal static extern bool FreeLibrary(IntPtr hModule);
index 76e43f6..4ee8642 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal enum GET_FILEEX_INFO_LEVELS : uint
         {
index 8d523e4..b22a149 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal unsafe struct CPINFO
index 620fe83..011430d 100644 (file)
@@ -6,9 +6,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameW")]
         private static extern unsafe int GetComputerName(ref char lpBuffer, ref uint nSize);
index 611cc70..4e30a8b 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer);
index 5b5ecc8..8164fd3 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern uint GetCurrentProcessId();
index c993519..a763735 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern IntPtr GetCurrentProcess();
index 29a6860..5594fe7 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentStringsW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern unsafe char* GetEnvironmentStrings();
index 13adefc..43463e5 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal static unsafe int GetEnvironmentVariable(string lpName, Span<char> buffer)
         {
index 00575c7..8d2e754 100644 (file)
@@ -6,9 +6,9 @@
 using System.IO;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use GetFileAttributesEx.
index d274917..92bee35 100644 (file)
@@ -5,9 +5,9 @@
 using Microsoft.Win32.SafeHandles;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool GetFileInformationByHandleEx(SafeFileHandle hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, out FILE_STANDARD_INFO lpFileInformation, uint dwBufferSize);
index 8a61352..cdde2f0 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern int GetFileType(SafeHandle hFile);
index 197b0a9..1bb63e7 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper.
index 657188f..2400eb3 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern int GetLogicalDrives();
index 49f8ea1..189c8e8 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper.
index 5894e2c..9860266 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const int ProcessLeapSecondInfo = 8;
 
index 98234b8..1d004bb 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal struct PROCESS_MEMORY_COUNTERS
index 1b694c9..4513945 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool GetProcessTimes(IntPtr handleProcess, out long creation, out long exit, out long kernel, out long user);
index f2b54c9..10cc486 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern IntPtr GetStdHandle(int nStdHandle);  // param is NOT a handle, but it returns one!
index 130eea6..9e5b21c 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
index c3cad18..ed0aa14 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime);
index fac974b..fc8b030 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe void GetSystemTimeAsFileTime(long* lpSystemTimeAsFileTime);
index 12bfb70..0067d90 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe void GetSystemTimePreciseAsFileTime(long* lpSystemTimeAsFileTime);
index 576c812..34f8ad7 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool GetSystemTimes(out long idle, out long kernel, out long user);
index 97e1d82..d7f9b82 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
         internal static extern uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
index 7f7bb77..8d2b0b1 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern uint GetTempPathW(int bufferLen, ref char buffer);
index 13a997a..5899bdb 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static extern bool GetVersionExW(ref OSVERSIONINFOEX osvi);
index a729b5c..e25c8ef 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal static unsafe bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer)
         {
index c2096aa..a5a42af 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal partial class HandleTypes
         {
index 7953da6..43936ab 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool IsWow64Process(IntPtr hProcess, out bool Wow64Process);
index bb69e2f..7693f62 100644 (file)
@@ -6,9 +6,9 @@ using Microsoft.Win32.SafeHandles;
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
         internal const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;
index 9c74adb..14486c2 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const uint LMEM_FIXED = 0x0000;
         internal const uint LMEM_MOVEABLE = 0x0002;
index 927203b..82c7e49 100644 (file)
@@ -5,9 +5,9 @@
 using Microsoft.Win32.SafeHandles;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
index f7fa326..9de12c9 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const int MAX_PATH = 260;
     }
index 402a264..83d1d86 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal struct MEMORYSTATUSEX
index 0744d53..ce49fb5 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal unsafe struct MEMORY_BASIC_INFORMATION
index ab6220e..d369cb4 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe int MultiByteToWideChar(
index 1bfe00c..0f6e2e6 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
         internal unsafe struct OSVERSIONINFOEX
index 8da50ff..3ad3edd 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "OutputDebugStringW", ExactSpelling = true)]
         internal static extern void OutputDebugString(string message);
index ddc9797..a945a31 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         // The actual native signature is:
         //      BOOL WINAPI QueryPerformanceCounter(
index 72a48ba..641451b 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         // The actual native signature is:
         //      BOOL WINAPI QueryPerformanceFrequency(
index db225ff..f7264d4 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
index 5fedb4e..b9f1c95 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern unsafe int ReadFile(
index e80be34..a3c7254 100644 (file)
@@ -6,9 +6,9 @@ using System;
 using System.Runtime.InteropServices;
 using System.Threading;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern unsafe int ReadFile(
index 1798cb4..f2f32fd 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal struct SECURITY_ATTRIBUTES
index 16e5bfd..0ebeeff 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential)]
         internal struct SYSTEM_INFO
index 4a44024..bc9f580 100644 (file)
@@ -2,11 +2,11 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
-        internal partial class SecurityOptions
+        internal static partial class SecurityOptions
         {
             internal const int SECURITY_SQOS_PRESENT = 0x00100000;
             internal const int SECURITY_ANONYMOUS = 0 << 16;
index b30e5d7..d268d4d 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern bool SetCurrentDirectory(string path);
index e5d6004..6d93e15 100644 (file)
@@ -5,9 +5,9 @@
 using Microsoft.Win32.SafeHandles;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool SetEndOfFile(SafeFileHandle hFile);
index b94ec21..243bd65 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
         internal static extern bool SetEnvironmentVariable(string lpName, string? lpValue);
index c0e5247..e838066 100644 (file)
@@ -5,9 +5,9 @@
 using Microsoft.Win32.SafeHandles;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod);
index 123eb75..14bc785 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)]
         internal static extern bool SetThreadErrorMode(uint dwNewMode, out uint lpOldMode);
index 7ee2f7b..c347eea 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, long* lpFileTime);
index 36f3e08..5cea7e0 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe Interop.BOOL TzSpecificLocalTimeToSystemTime(
index 385e48a..96e6172 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition);
index 5c2471c..f8bd85a 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const byte VER_GREATER_EQUAL = 0x3;
         internal const uint VER_MAJORVERSION = 0x0000002;
index a97dc1a..57dcbf8 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal const int MEM_COMMIT = 0x1000;
         internal const int MEM_RESERVE = 0x2000;
index 07a1805..75dbdf0 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe bool VirtualFree(void* lpAddress, UIntPtr dwSize, int dwFreeType);
index 5f57f73..1c96556 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, SetLastError = true)]
         internal static extern unsafe UIntPtr VirtualQuery(void* lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength);
index 971b311..0560744 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         internal struct WIN32_FILE_ATTRIBUTE_DATA
         {
index c8d319d..f1ed25f 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
         internal unsafe struct WIN32_FIND_DATA
index a06c915..1925a8c 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         [DllImport(Libraries.Kernel32)]
         internal static extern unsafe int WideCharToMultiByte(
index ea69950..e25d205 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         // Note there are two different WriteFile prototypes - this is to use
         // the type system to force you to not trip across a "feature" in
index 5660cce..9c01f0a 100644 (file)
@@ -5,9 +5,10 @@
 using System;
 using System.Runtime.InteropServices;
 using System.Threading;
-internal partial class Interop
+
+internal static partial class Interop
 {
-    internal partial class Kernel32
+    internal static partial class Kernel32
     {
         // Note there are two different WriteFile prototypes - this is to use
         // the type system to force you to not trip across a "feature" in
index 4059c70..039e34b 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Normaliz
+    internal static partial class Normaliz
     {
         //
         //  Idn APIs
index a77ccef..3e95448 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Normaliz
+    internal static partial class Normaliz
     {
         [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
         internal static extern bool IsNormalizedString(int normForm, string source, int length);
index 98040ad..ed36e78 100644 (file)
@@ -6,9 +6,9 @@ using Microsoft.Win32.SafeHandles;
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class NtDll
+    internal static partial class NtDll
     {
         [DllImport(Libraries.NtDll, ExactSpelling = true)]
         internal static extern unsafe int NtQueryInformationFile(
index 9f308bb..dc8be88 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class NtDll
+    internal static partial class NtDll
     {
         [DllImport(Libraries.NtDll)]
         internal static extern unsafe int NtQuerySystemInformation(int SystemInformationClass, void* SystemInformation, int SystemInformationLength, uint* ReturnLength);
index 9119ee7..e51dc99 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Ole32
+    internal static partial class Ole32
     {
         [DllImport(Libraries.Ole32)]
         internal static extern IntPtr CoTaskMemAlloc(UIntPtr cb);
index 846283a..7c97ecd 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class OleAut32
+    internal static partial class OleAut32
     {
         [DllImport(Libraries.OleAut32)]
         internal static extern IntPtr SysAllocStringByteLen(byte[]? str, uint len);
index 4980844..a7c09b2 100644 (file)
@@ -6,9 +6,9 @@ using System;
 using System.Runtime.InteropServices;
 using System.Security;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class OleAut32
+    internal static partial class OleAut32
     {
         [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)]
         internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len);
index 8673cc6..fea22df 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class OleAut32
+    internal static partial class OleAut32
     {
         [DllImport(Libraries.OleAut32)]
         internal static extern void SysFreeString(IntPtr bstr);
index cf65d6b..a80821b 100644 (file)
@@ -6,9 +6,9 @@ using System;
 using System.Runtime.InteropServices;
 using System.Security;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class OleAut32
+    internal static partial class OleAut32
     {
         [DllImport(Libraries.OleAut32)]
         internal static extern uint SysStringLen(SafeBSTRHandle bstr);
index cf0dd5f..e88864c 100644 (file)
@@ -4,9 +4,9 @@
 
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Secur32
+    internal static partial class Secur32
     {
         [DllImport(Libraries.Secur32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static extern BOOLEAN GetUserNameExW(int NameFormat, ref char lpNameBuffer, ref uint lpnSize);
index 1090805..3e72b01 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class Shell32
+    internal static partial class Shell32
     {
         internal const int COR_E_PLATFORMNOTSUPPORTED = unchecked((int)0x80131539);
 
index f1f0974..a48329f 100644 (file)
@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class User32
+    internal static partial class User32
     {
         internal const int HWND_BROADCAST = 0xffff;
         internal const int WM_SETTINGCHANGE = 0x001A;
index 52e391c..e328e9b 100644 (file)
@@ -5,9 +5,9 @@
 using System.Runtime.InteropServices;
 using Microsoft.Win32.SafeHandles;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class User32
+    internal static partial class User32
     {
         [DllImport(Libraries.User32, SetLastError = true, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode)]
         internal static extern unsafe int LoadString(SafeLibraryHandle hInstance, uint uID, char* lpBuffer, int cchBufferMax);
index c8a97e6..f73c0ac 100644 (file)
@@ -5,9 +5,9 @@
 using System;
 using System.Runtime.InteropServices;
 
-internal partial class Interop
+internal static partial class Interop
 {
-    internal partial class User32
+    internal static partial class User32
     {
         [DllImport(Libraries.User32, EntryPoint = "SendMessageTimeoutW", CharSet = CharSet.Unicode)]
         public static extern IntPtr SendMessageTimeout(IntPtr hWnd, int msg, IntPtr wParam, string lParam, int flags, int timeout, IntPtr pdwResult);
index 6f67366..bd94a49 100644 (file)
@@ -17,7 +17,7 @@ namespace System
     [AttributeUsage(AttributeTargets.Class, Inherited = true)]
     public sealed class AttributeUsageAttribute : Attribute
     {
-        private readonly AttributeTargets _attributeTarget = AttributeTargets.All; // Defaults to all
+        private readonly AttributeTargets _attributeTarget; // Defaults to all
         private bool _allowMultiple = false; // Defaults to false
         private bool _inherited = true; // Defaults to true
 
index 7607145..3d2ce78 100644 (file)
@@ -13,7 +13,6 @@
 ===========================================================*/
 
 using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
 
 namespace System.Collections
 {
index 66e8c75..b15719b 100644 (file)
@@ -2,7 +2,6 @@
 // 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.Globalization;
 using System.Reflection;
 using System.Threading;
index a24339f..232a82c 100644 (file)
@@ -10,7 +10,6 @@ using System.Security.Permissions;
 using BitOperations = Microsoft.Diagnostics.Tracing.Internal.BitOperations;
 #endif
 using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
 using System.Globalization;
 using System.Numerics;
 using System.Runtime.InteropServices;
@@ -1200,10 +1199,8 @@ namespace System.Diagnostics.Tracing
             return m_eventProvider.EventRegister(eventSource, enableCallback, null, ref m_regHandle);
         }
 
-        private uint EventUnregister(long registrationHandle)
-        {
-            return m_eventProvider.EventUnregister(registrationHandle);
-        }
+        private void EventUnregister(long registrationHandle) =>
+            m_eventProvider.EventUnregister(registrationHandle);
 
 #if PLATFORM_WINDOWS
         private static bool m_setInformationMissing;
index 37b9a4d..fa6c877 100644 (file)
@@ -308,9 +308,8 @@ namespace System.Diagnostics.Tracing
             {
                 if (attrib.Guid != null)
                 {
-                    Guid g = Guid.Empty;
 #if !ES_BUILD_AGAINST_DOTNET_V35
-                    if (Guid.TryParse(attrib.Guid, out g))
+                    if (Guid.TryParse(attrib.Guid, out Guid g))
                         return g;
 #else
                     try { return new Guid(attrib.Guid); }
@@ -2654,7 +2653,6 @@ namespace System.Diagnostics.Tracing
 #endif
 
             m_outOfBandMessageCount = 0;
-            bool shouldReport = (commandArgs.perEventSourceSessionId > 0) && (commandArgs.perEventSourceSessionId <= SessionMask.MAX);
             try
             {
                 EnsureDescriptorsInitialized();
@@ -2924,12 +2922,10 @@ namespace System.Diagnostics.Tracing
 
         // Send out the ETW manifest XML out to ETW
         // Today, we only send the manifest to ETW, custom listeners don't get it.
-        private unsafe bool SendManifest(byte[]? rawManifest)
+        private unsafe void SendManifest(byte[]? rawManifest)
         {
-            bool success = true;
-
             if (rawManifest == null)
-                return false;
+                return;
 
             Debug.Assert(!SelfDescribingEvents);
 
@@ -2978,7 +2974,7 @@ namespace System.Diagnostics.Tracing
                                     goto TRY_AGAIN_WITH_SMALLER_CHUNK_SIZE;
                                 }
                             }
-                            success = false;
+
                             if (ThrowOnEventWriteErrors)
                                 ThrowEventSourceException("SendManifest");
                             break;
@@ -2997,7 +2993,6 @@ namespace System.Diagnostics.Tracing
                 }
             }
 #endif // FEATURE_MANAGED_ETW
-            return success;
         }
 
 #if (ES_BUILD_PCL)
@@ -3028,13 +3023,6 @@ namespace System.Diagnostics.Tracing
             }
 
 #if (!ES_BUILD_PCL && !ES_BUILD_PN)
-            // In the reflection only context, we have to do things by hand.
-            string fullTypeNameToFind = attributeType.FullName!;
-
-#if EVENT_SOURCE_LEGACY_NAMESPACE_SUPPORT
-            fullTypeNameToFind = fullTypeNameToFind.Replace("System.Diagnostics.Eventing", "System.Diagnostics.Tracing");
-#endif
-
             foreach (CustomAttributeData data in CustomAttributeData.GetCustomAttributes(member))
             {
                 if (AttributeTypeNamesMatch(attributeType, data.Constructor.ReflectedType!))
@@ -3878,10 +3866,10 @@ namespace System.Diagnostics.Tracing
 
         internal static uint s_currentPid;              // current process id, used in synthesizing quasi-GUIDs
         [ThreadStatic]
-        private static byte m_EventSourceExceptionRecurenceCount = 0; // current recursion count inside ThrowEventSourceException
+        private static byte m_EventSourceExceptionRecurenceCount; // current recursion count inside ThrowEventSourceException
 
         [ThreadStatic]
-        private static bool m_EventSourceInDecodeObject = false;
+        private static bool m_EventSourceInDecodeObject;
 
 #if FEATURE_MANAGED_ETW_CHANNELS
         internal volatile ulong[]? m_channelData;
@@ -4514,7 +4502,7 @@ namespace System.Diagnostics.Tracing
         /// and another EventSource is created as part of the process.
         /// </summary>
         [ThreadStatic]
-        private static bool s_ConnectingEventSourcesAndListener = false;
+        private static bool s_ConnectingEventSourcesAndListener;
 #endif
 
         /// <summary>
index f4588f8..ca6930d 100644 (file)
@@ -950,6 +950,7 @@ namespace System
                     break;
                 case 'r':
                 case 'R':       // RFC 1123 Standard
+                case 'u':       // Universal time in sortable format.
                     if (offset != NullOffset)
                     {
                         // Convert to UTC invariants mean this will be in range
@@ -960,14 +961,6 @@ namespace System
                 case 's':       // Sortable without Time Zone Info
                     dtfi = DateTimeFormatInfo.InvariantInfo;
                     break;
-                case 'u':       // Universal time in sortable format.
-                    if (offset != NullOffset)
-                    {
-                        // Convert to UTC invariants mean this will be in range
-                        dateTime -= offset;
-                    }
-                    dtfi = DateTimeFormatInfo.InvariantInfo;
-                    break;
                 case 'U':       // Universal time in culture dependent format.
                     if (offset != NullOffset)
                     {
index 664abfd..188c980 100644 (file)
@@ -4265,12 +4265,8 @@ new DS[] { DS.ERROR,  DS.TX_NNN,  DS.TX_NNN,  DS.TX_NNN,  DS.ERROR,   DS.ERROR,
                     // with this issue.
                     if ((result.flags & ParseFlags.CaptureOffset) != 0)
                     {
-                        if ((result.flags & ParseFlags.Rfc1123Pattern) != 0 && quotedStr == GMTName)
-                        {
-                            result.flags |= ParseFlags.TimeZoneUsed;
-                            result.timeZoneOffset = TimeSpan.Zero;
-                        }
-                        else if ((result.flags & ParseFlags.UtcSortPattern) != 0 && quotedStr == ZuluName)
+                        if (((result.flags & ParseFlags.Rfc1123Pattern) != 0 && quotedStr == GMTName) ||
+                            ((result.flags & ParseFlags.UtcSortPattern) != 0 && quotedStr == ZuluName))
                         {
                             result.flags |= ParseFlags.TimeZoneUsed;
                             result.timeZoneOffset = TimeSpan.Zero;
index c1f8d96..589a8b6 100644 (file)
@@ -97,7 +97,7 @@ namespace System.Globalization
             0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
         };
 
-        internal int m_maxYear = 9999;
+        internal int m_maxYear;
         internal int m_minYear;
         internal Calendar m_Cal;
 
index e811ddb..cf8e495 100644 (file)
@@ -17,7 +17,6 @@
 using System.Buffers.Binary;
 using System.Diagnostics;
 using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
 using System.Text;
 
 namespace System.IO
index 7e9fa81..2429f28 100644 (file)
@@ -2290,7 +2290,6 @@ namespace System
 
             char* digits = stackalloc char[MaxUInt32DecDigits];
             char* p = UInt32ToDecChars(digits + MaxUInt32DecDigits, (uint)value, minDigits);
-            int i = (int)(digits + MaxUInt32DecDigits - p);
             sb.Append(p, (int)(digits + MaxUInt32DecDigits - p));
         }
 
@@ -2466,8 +2465,7 @@ namespace System
                     {
                         case '\'':
                         case '"':
-                            while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch)
-                                ;
+                            while (src < format.Length && pFormat[src] != 0 && pFormat[src++] != ch) ;
                             break;
                         case '\\':
                             if (src < format.Length && pFormat[src] != 0)
index 17cfdfe..7b5f6f1 100644 (file)
@@ -303,8 +303,7 @@ namespace System.Reflection
                         short maxSize = (short)Math.Min(end - i, (int)c_MaxUnicodeCharsReallocate - 1);
 
                         short count = 1;
-                        for (; count < maxSize && pStr[i + count] > '\x7f'; ++count)
-                            ;
+                        for (; count < maxSize && pStr[i + count] > '\x7f'; ++count) ;
 
                         // Is the last a high surrogate?
                         if (pStr[i + count - 1] >= 0xD800 && pStr[i + count - 1] <= 0xDBFF)
@@ -355,14 +354,7 @@ namespace System.Reflection
                         }
                         prevInputPos = i + 1;
                     }
-                    else if (ch == force1 || ch == force2)
-                    {
-                        dest = EnsureDestinationSize(pStr, dest, i, c_EncodedCharsPerByte,
-                            c_MaxAsciiCharsReallocate * c_EncodedCharsPerByte, ref destPos, prevInputPos);
-                        EscapeAsciiChar(ch, dest, ref destPos);
-                        prevInputPos = i + 1;
-                    }
-                    else if (ch != rsvd && (isUriString ? !IsReservedUnreservedOrHash(ch) : !IsUnreserved(ch)))
+                    else if (ch == force1 || ch == force2 || (ch != rsvd && (isUriString ? !IsReservedUnreservedOrHash(ch) : !IsUnreserved(ch))))
                     {
                         dest = EnsureDestinationSize(pStr, dest, i, c_EncodedCharsPerByte,
                             c_MaxAsciiCharsReallocate * c_EncodedCharsPerByte, ref destPos, prevInputPos);
index e99872c..ae749f4 100644 (file)
@@ -266,9 +266,9 @@ namespace System.Runtime.CompilerServices
             // there is any outstanding enumerator, no compaction is performed.
 
             private ConditionalWeakTable<TKey, TValue>? _table; // parent table, set to null when disposed
-            private readonly int _maxIndexInclusive;           // last index in the container that should be enumerated
-            private int _currentIndex = -1;                    // the current index into the container
-            private KeyValuePair<TKey, TValue> _current;       // the current entry set by MoveNext and returned from Current
+            private readonly int _maxIndexInclusive;            // last index in the container that should be enumerated
+            private int _currentIndex;                          // the current index into the container
+            private KeyValuePair<TKey, TValue> _current;        // the current entry set by MoveNext and returned from Current
 
             public Enumerator(ConditionalWeakTable<TKey, TValue> table)
             {
index c9f8766..053a70f 100644 (file)
@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
 using System.Runtime.ConstrainedExecution;
 using System.Threading;
 
index 7b3dc43..b63068e 100644 (file)
@@ -25,10 +25,9 @@ namespace System.Runtime
         // returns whether there is enough space.  In all cases, we update
         // our last known free address space, hopefully avoiding needing to
         // probe again.
-        private static bool CheckForFreeAddressSpace(ulong size, bool shouldThrow)
+        private static void CheckForFreeAddressSpace(ulong size, bool shouldThrow)
         {
             // Unreachable until CheckForAvailableMemory is implemented
-            return false;
         }
 
         // Allocate a specified number of bytes, commit them and free them. This should enlarge
index 0c02ffb..a3ca2d0 100644 (file)
@@ -27,11 +27,10 @@ namespace System.Runtime
             return true;
         }
 
-        // Based on the shouldThrow parameter, this will throw an exception, or
-        // returns whether there is enough space.  In all cases, we update
-        // our last known free address space, hopefully avoiding needing to
-        // probe again.
-        private static unsafe bool CheckForFreeAddressSpace(ulong size, bool shouldThrow)
+        // Based on the shouldThrow parameter, this will throw an exception.
+        // In all cases, we update our last known free address space, hopefully
+        // avoiding needing to probe again.
+        private static unsafe void CheckForFreeAddressSpace(ulong size, bool shouldThrow)
         {
             // Start walking the address space at 0.  VirtualAlloc may wrap
             // around the address space.  We don't need to find the exact
@@ -50,7 +49,6 @@ namespace System.Runtime
 
             if (freeSpaceAfterGCHeap < size && shouldThrow)
                 throw new InsufficientMemoryException(SR.InsufficientMemory_MemFailPoint_VAFrag);
-            return freeSpaceAfterGCHeap >= size;
         }
 
         // Returns the amount of consecutive free memory available in a block
index 66c2be4..04dcc95 100644 (file)
@@ -95,7 +95,7 @@ namespace System.Runtime
             set => Volatile.Write(ref s_hiddenLastKnownFreeAddressSpace, value);
         }
 
-        private static long AddToLastKnownFreeAddressSpace(long addend) =>
+        private static void AddToLastKnownFreeAddressSpace(long addend) =>
             Interlocked.Add(ref s_hiddenLastKnownFreeAddressSpace, addend);
 
         private static long LastTimeCheckingAddressSpace
index 200a4be..490074f 100644 (file)
@@ -519,7 +519,7 @@ namespace System.Runtime.Serialization
             if (value == null)
                 return null;
 
-            if (ReferenceEquals(foundType, type) || type.IsAssignableFrom(foundType) || value == null)
+            if (ReferenceEquals(foundType, type) || type.IsAssignableFrom(foundType))
             {
                 return value;
             }
index 6dca047..4b05402 100644 (file)
@@ -1953,8 +1953,6 @@ namespace System.Text
 
             newValue ??= string.Empty;
 
-            int deltaLength = newValue.Length - oldValue.Length;
-
             int[]? replacements = null; // A list of replacement positions in a chunk to apply
             int replacementsCount = 0;
 
@@ -1992,7 +1990,6 @@ namespace System.Text
                 {
                     // Replacing mutates the blocks, so we need to convert to a logical index and back afterwards.
                     int index = indexInChunk + chunk.m_ChunkOffset;
-                    int indexBeforeAdjustment = index;
 
                     // See if we accumulated any replacements, if so apply them.
                     Debug.Assert(replacements != null || replacementsCount == 0, "replacements was null and replacementsCount != 0");
index db75688..76df327 100644 (file)
@@ -2,8 +2,6 @@
 // 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;
-
 namespace System.Text
 {
     /// <summary>
index 968144a..6f85615 100644 (file)
@@ -2,7 +2,6 @@
 // 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.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using Internal.Runtime.CompilerServices;
 
index f3fdfc4..e804d38 100644 (file)
@@ -223,8 +223,7 @@ namespace System.Threading
         /// being stored and used. The event will be signaled or unsignaled depending on
         /// the state of the thin-event itself, with synchronization taken into account.
         /// </summary>
-        /// <returns>True if a new event was created and stored, false otherwise.</returns>
-        private bool LazyInitializeEvent()
+        private void LazyInitializeEvent()
         {
             bool preInitializeIsSet = IsSet;
             ManualResetEvent newEventObj = new ManualResetEvent(preInitializeIsSet);
@@ -235,8 +234,6 @@ namespace System.Threading
             {
                 // Someone else set the value due to a race condition. Destroy the garbage event.
                 newEventObj.Dispose();
-
-                return false;
             }
             else
             {
@@ -261,8 +258,6 @@ namespace System.Threading
                         }
                     }
                 }
-
-                return true;
             }
         }
 
index 91c8bc9..545d224 100644 (file)
@@ -468,7 +468,7 @@ namespace System.Threading.Tasks
             // touch all Task.Id fields so that the debugger doesn't need to do a lot of cross-proc calls to generate them
             foreach (Task t in activeTasksArray)
             {
-                int tmp = t.Id;
+                _ = t.Id;
             }
 
             return activeTasksArray;
@@ -508,7 +508,7 @@ namespace System.Threading.Tasks
             foreach (TaskScheduler scheduler in arr)
             {
                 Debug.Assert(scheduler != null, "Table returned an incorrect Count or CopyTo failed");
-                int tmp = scheduler.Id; // force Ids for debugger
+                _ = scheduler.Id; // force Ids for debugger
             }
             return arr;
         }
index e8d1849..359d336 100644 (file)
@@ -67,7 +67,7 @@ namespace System.Threading.Tasks
         }
 
         /// <summary>ETW tasks that have start/stop events.</summary>
-        public class Tasks // this name is important for EventSource
+        public static class Tasks // this name is important for EventSource
         {
             /// <summary>A parallel loop.</summary>
             public const EventTask Loop = (EventTask)1;
@@ -89,7 +89,7 @@ namespace System.Threading.Tasks
             public const EventTask TraceSynchronousWork = (EventTask)9;
         }
 
-        public class Keywords // thisname is important for EventSource
+        public static class Keywords // this name is important for EventSource
         {
             /// <summary>
             /// Only the most basic information about the workings of the task library
index eb1444c..8a935bf 100644 (file)
@@ -1612,6 +1612,58 @@ namespace System
             }
         }
 
+        /// <summary>
+        /// Normalize adjustment rule offset so that it is within valid range
+        /// This method should not be called at all but is here in case something changes in the future
+        /// or if really old time zones are present on the OS (no combination is known at the moment)
+        /// </summary>
+        private static void NormalizeAdjustmentRuleOffset(TimeSpan baseUtcOffset, [NotNull] ref AdjustmentRule adjustmentRule)
+        {
+            // Certain time zones such as:
+            //       Time Zone  start date  end date    offset
+            // -----------------------------------------------------
+            // America/Yakutat  0001-01-01  1867-10-18   14:41:00
+            // America/Yakutat  1867-10-18  1900-08-20   14:41:00
+            // America/Sitka    0001-01-01  1867-10-18   14:58:00
+            // America/Sitka    1867-10-18  1900-08-20   14:58:00
+            // Asia/Manila      0001-01-01  1844-12-31  -15:56:00
+            // Pacific/Guam     0001-01-01  1845-01-01  -14:21:00
+            // Pacific/Saipan   0001-01-01  1845-01-01  -14:21:00
+            //
+            // have larger offset than currently supported by framework.
+            // If for whatever reason we find that time zone exceeding max
+            // offset of 14h this function will truncate it to the max valid offset.
+            // Updating max offset may cause problems with interacting with SQL server
+            // which uses SQL DATETIMEOFFSET field type which was originally designed to be
+            // bit-for-bit compatible with DateTimeOffset.
+
+            TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
+
+            // utc base offset delta increment
+            TimeSpan adjustment = TimeSpan.Zero;
+
+            if (utcOffset > MaxOffset)
+            {
+                adjustment = MaxOffset - utcOffset;
+            }
+            else if (utcOffset < MinOffset)
+            {
+                adjustment = MinOffset - utcOffset;
+            }
+
+            if (adjustment != TimeSpan.Zero)
+            {
+                adjustmentRule = AdjustmentRule.CreateAdjustmentRule(
+                    adjustmentRule.DateStart,
+                    adjustmentRule.DateEnd,
+                    adjustmentRule.DaylightDelta,
+                    adjustmentRule.DaylightTransitionStart,
+                    adjustmentRule.DaylightTransitionEnd,
+                    adjustmentRule.BaseUtcOffsetDelta + adjustment,
+                    adjustmentRule.NoDaylightTransitions);
+            }
+        }
+
         private struct TZifType
         {
             public const int Length = 6;
index 633f0d5..1d9cb5f 100644 (file)
@@ -1998,57 +1998,5 @@ namespace System
             TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
             return !UtcOffsetOutOfRange(utcOffset);
         }
-
-        /// <summary>
-        /// Normalize adjustment rule offset so that it is within valid range
-        /// This method should not be called at all but is here in case something changes in the future
-        /// or if really old time zones are present on the OS (no combination is known at the moment)
-        /// </summary>
-        private static void NormalizeAdjustmentRuleOffset(TimeSpan baseUtcOffset, [NotNull] ref AdjustmentRule adjustmentRule)
-        {
-            // Certain time zones such as:
-            //       Time Zone  start date  end date    offset
-            // -----------------------------------------------------
-            // America/Yakutat  0001-01-01  1867-10-18   14:41:00
-            // America/Yakutat  1867-10-18  1900-08-20   14:41:00
-            // America/Sitka    0001-01-01  1867-10-18   14:58:00
-            // America/Sitka    1867-10-18  1900-08-20   14:58:00
-            // Asia/Manila      0001-01-01  1844-12-31  -15:56:00
-            // Pacific/Guam     0001-01-01  1845-01-01  -14:21:00
-            // Pacific/Saipan   0001-01-01  1845-01-01  -14:21:00
-            //
-            // have larger offset than currently supported by framework.
-            // If for whatever reason we find that time zone exceeding max
-            // offset of 14h this function will truncate it to the max valid offset.
-            // Updating max offset may cause problems with interacting with SQL server
-            // which uses SQL DATETIMEOFFSET field type which was originally designed to be
-            // bit-for-bit compatible with DateTimeOffset.
-
-            TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
-
-            // utc base offset delta increment
-            TimeSpan adjustment = TimeSpan.Zero;
-
-            if (utcOffset > MaxOffset)
-            {
-                adjustment = MaxOffset - utcOffset;
-            }
-            else if (utcOffset < MinOffset)
-            {
-                adjustment = MinOffset - utcOffset;
-            }
-
-            if (adjustment != TimeSpan.Zero)
-            {
-                adjustmentRule = AdjustmentRule.CreateAdjustmentRule(
-                    adjustmentRule.DateStart,
-                    adjustmentRule.DateEnd,
-                    adjustmentRule.DaylightDelta,
-                    adjustmentRule.DaylightTransitionStart,
-                    adjustmentRule.DaylightTransitionEnd,
-                    adjustmentRule.BaseUtcOffsetDelta + adjustment,
-                    adjustmentRule.NoDaylightTransitions);
-            }
-        }
     }
 }