More corelib cleanup (dotnet/coreclr#26993)
commit1e3d0174797c3abb24773fe423c338de50cb4f1a
authorStephen Toub <stoub@microsoft.com>
Thu, 3 Oct 2019 19:28:18 +0000 (3 15:28 -0400)
committerMarek Safar <marek.safar@gmail.com>
Sat, 5 Oct 2019 12:09:54 +0000 (5 14:09 +0200)
tree00b7ed759bbee965e7b125f0466f80cd4db42340
parent820542466734e0a1c73587b1ef3851c2de11250a
More corelib cleanup (dotnet/coreclr#26993)

* 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

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