From 47bcd1a8b053c2dcd05b47da033587199167e790 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Sat, 12 Feb 2022 18:44:41 +0100 Subject: [PATCH] Remove unused private parameters in SPC (#63015) --- eng/CodeAnalysis.src.globalconfig | 3 ++- .../ComActivator.PlatformNotSupported.cs | 2 ++ .../src/System/Array.CoreCLR.cs | 8 +++--- .../System/Diagnostics/StackFrame.CoreCLR.cs | 2 ++ .../src/System/MulticastDelegate.cs | 2 ++ .../System/Reflection/Emit/PropertyBuilder.cs | 1 - .../src/System/Reflection/Emit/TypeBuilder.cs | 1 - .../src/System/RuntimeType.CoreCLR.cs | 4 +-- .../TypeInfos/RuntimeTypeInfo.BindingFlags.cs | 4 +-- .../Win32/SafeHandles/SafeFileHandle.Unix.cs | 10 +++---- .../Buffers/Text/Utf8Parser/ParserHelpers.cs | 2 +- .../src/System/ByReference.cs | 2 ++ .../src/System/Collections/Hashtable.cs | 2 +- .../src/System/DateTime.Unix.cs | 7 +++++ .../src/System/DefaultBinder.cs | 4 +-- .../src/System/Environment.NoRegistry.cs | 6 ++++- .../src/System/Globalization/Calendar.cs | 2 +- .../System/Globalization/CalendarData.Icu.cs | 2 +- .../System/Globalization/CalendarData.Unix.cs | 2 ++ .../System/Globalization/CultureData.Icu.cs | 2 +- .../System/Globalization/CultureData.Unix.cs | 7 ++--- .../src/System/Globalization/CultureData.cs | 2 +- .../src/System/Globalization/DateTimeParse.cs | 4 ++- .../src/System/IO/FileSystem.Unix.cs | 13 +++++++--- .../IO/Strategies/FileStreamHelpers.Unix.cs | 4 ++- .../src/System/Resources/ResourceSet.cs | 2 +- .../CompilerServices/RuntimeHelpers.cs | 3 ++- .../Runtime/InteropServices/Marshal.NoCom.cs | 2 ++ .../Runtime/InteropServices/Marshal.Unix.cs | 2 ++ .../System/Runtime/InteropServices/Marshal.cs | 2 ++ .../Loader/LibraryNameVariation.Unix.cs | 2 +- .../Loader/LibraryNameVariation.Windows.cs | 3 +-- .../System/Runtime/MemoryFailPoint.Unix.cs | 2 ++ .../src/System/Runtime/MemoryFailPoint.cs | 6 ++--- .../src/System/Text/Rune.cs | 2 +- .../System/Threading/EventWaitHandle.Unix.cs | 2 ++ .../src/System/Threading/Semaphore.Unix.cs | 2 ++ .../System/Threading/ThreadPool.Portable.cs | 10 +++++-- .../System/Threading/TimerQueue.Portable.cs | 2 ++ ...TimeZoneInfo.FullGlobalizationData.Unix.cs | 2 ++ .../src/System/TimeZoneInfo.Unix.cs | 26 ++++++------------- .../src/System/Array.Mono.cs | 8 +++--- .../src/System/Diagnostics/StackFrame.Mono.cs | 2 ++ .../src/System/IO/FileLoadException.Mono.cs | 2 ++ .../src/System/MissingMemberException.Mono.cs | 2 ++ .../Reflection/Emit/AssemblyBuilder.Mono.cs | 2 +- .../Emit/ConstructorBuilder.Mono.cs | 6 ++--- .../Reflection/Emit/EventBuilder.Mono.cs | 6 ++--- .../Reflection/Emit/MethodBuilder.Mono.cs | 6 ++--- .../Reflection/Emit/ModuleBuilder.Mono.cs | 6 ++--- .../Reflection/Emit/ParameterBuilder.Mono.cs | 2 +- .../Reflection/Emit/PropertyBuilder.Mono.cs | 2 +- .../Reflection/Emit/TypeBuilder.Mono.cs | 6 ++--- .../src/System/Reflection/MethodBase.Mono.cs | 2 +- .../Reflection/RuntimeMethodInfo.Mono.cs | 4 +-- .../System/Reflection/RuntimePropertyInfo.cs | 2 +- .../Runtime/CompilerServices/JitHelpers.cs | 2 ++ .../InteropServices/ObjectiveCMarshal.Mono.cs | 1 + .../Loader/AssemblyLoadContext.Mono.cs | 2 ++ .../src/System/RuntimeFieldHandle.cs | 2 +- .../src/System/RuntimeMethodHandle.cs | 2 +- .../src/System/RuntimeType.Mono.cs | 6 ++--- .../src/System/RuntimeTypeHandle.cs | 10 +++---- .../LowLevelLifoSemaphore.Unix.Mono.cs | 2 ++ .../Threading/PreAllocatedOverlapped.cs | 1 - .../src/System/Threading/ThreadPool.Mono.cs | 2 ++ .../PrepareForReadyToRunCompilation.cs | 4 +-- 67 files changed, 153 insertions(+), 107 deletions(-) diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig index df9d7285695cf..e4d3c09e15b49 100644 --- a/eng/CodeAnalysis.src.globalconfig +++ b/eng/CodeAnalysis.src.globalconfig @@ -774,7 +774,7 @@ dotnet_diagnostic.CA5383.severity = none # CA5384: Do Not Use Digital Signature Algorithm (DSA) dotnet_diagnostic.CA5384.severity = warning -# CA5385: Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size +# CA5385: Use Rivest-Shamir-Adleman (RSA) Algorithm With Sufficient Key Size dotnet_diagnostic.CA5385.severity = warning # CA5386: Avoid hardcoding SecurityProtocolType value @@ -1448,6 +1448,7 @@ dotnet_diagnostic.IDE0059.severity = warning # IDE0060: Remove unused parameter dotnet_diagnostic.IDE0060.severity = silent +dotnet_code_quality_unused_parameters = non_public # IDE0061: Use expression body for local functions dotnet_diagnostic.IDE0061.severity = silent diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs index 1bb64cf6f4cf3..4492eac6d3ada 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs @@ -4,6 +4,8 @@ using System; using System.Runtime.InteropServices; +#pragma warning disable IDE0060 + namespace Internal.Runtime.InteropServices { public static class ComActivator diff --git a/src/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs index 482752ba46ffb..4bec553850702 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Array.CoreCLR.cs @@ -521,7 +521,7 @@ internal void set_Item(int index, T value) _this[index] = value; } - private void Add(T value) + private void Add(T _) { // Not meaningful for arrays. ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); @@ -556,20 +556,20 @@ private int IndexOf(T value) return Array.IndexOf(_this, value, 0, _this.Length); } - private void Insert(int index, T value) + private void Insert(int _, T _1) { // Not meaningful for arrays ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } - private bool Remove(T value) + private bool Remove(T _) { // Not meaningful for arrays ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); return default; } - private void RemoveAt(int index) + private void RemoveAt(int _) { // Not meaningful for arrays ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs index ab53609931660..48397813c6126 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs @@ -52,7 +52,9 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo) } } +#pragma warning disable IDE0060 private static bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false; +#pragma warning restore IDE0060 [GeneratedDllImport(RuntimeHelpers.QCall, EntryPoint = "StackFrame_GetMethodDescFromNativeIP")] private static partial RuntimeMethodHandleInternal GetMethodDescFromNativeIP(IntPtr ip); diff --git a/src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.cs b/src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.cs index 6abac717392c3..4166d91f4f02e 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.cs @@ -571,6 +571,7 @@ protected override MethodInfo GetMethodImpl() private static void ThrowNullThisInDelegateToInstance() => throw new ArgumentException(SR.Arg_DlgtNullInst); +#pragma warning disable IDE0060 [System.Diagnostics.DebuggerNonUserCode] private void CtorClosed(object target, IntPtr methodPtr) { @@ -635,5 +636,6 @@ private void CtorCollectibleVirtualDispatch(object target, IntPtr methodPtr, Int this._methodPtrAux = GetCallStub(methodPtr); this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle); } +#pragma warning restore IDE0060 } } diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs index 71dfd932e1260..cb619bde1353d 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs @@ -28,7 +28,6 @@ public sealed class PropertyBuilder : PropertyInfo internal PropertyBuilder( ModuleBuilder mod, // the module containing this PropertyBuilder string name, // property name - SignatureHelper sig, // property signature descriptor info PropertyAttributes attr, // property attribute such as DefaultProperty, Bindable, DisplayBind, etc Type returnType, // return type of the property. int prToken, // the metadata token for this property diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs index 0f353d383e0af..f5823d837f384 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs @@ -1774,7 +1774,6 @@ private PropertyBuilder DefinePropertyNoLock(string name, PropertyAttributes att return new PropertyBuilder( m_module, name, - sigHelper, attributes, returnType, prToken, diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs index 0e966a690f419..514184d44729b 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @@ -2800,7 +2800,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo; + return System.DefaultBinder.ExactBinding(candidates.ToArray(), types) as ConstructorInfo; binder ??= DefaultBinder; return binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as ConstructorInfo; @@ -2836,7 +2836,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers); + return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types); binder ??= DefaultBinder; return binder.SelectProperty(bindingAttr, candidates.ToArray(), returnType, types, modifiers); diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs index 7193fd2cff885..4f234fb116c1b 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs @@ -39,7 +39,7 @@ protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindin } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo; + return System.DefaultBinder.ExactBinding(candidates.ToArray(), types) as ConstructorInfo; if (binder == null) binder = DefaultBinder; @@ -173,7 +173,7 @@ protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers); + return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types); if (binder == null) binder = DefaultBinder; diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs index 8a601345ee00a..a40d4cc6c73f5 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs @@ -184,9 +184,7 @@ internal static SafeFileHandle Open(string fullPath, FileMode mode, FileAccess a Interop.Sys.Permissions openPermissions = DefaultOpenPermissions, Func? createOpenException = null) { - long fileLength; - Interop.Sys.Permissions filePermissions; - return Open(fullPath, mode, access, share, options, preallocationSize, openPermissions, out fileLength, out filePermissions, createOpenException); + return Open(fullPath, mode, access, share, options, preallocationSize, openPermissions, out _, out _, createOpenException); } private static SafeFileHandle Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, @@ -317,7 +315,7 @@ private bool Init(string path, FileMode mode, FileAccess access, FileShare share if ((access & FileAccess.Write) == 0) { // Stat the file descriptor to avoid race conditions. - FStatCheckIO(this, path, ref status, ref statusHasValue); + FStatCheckIO(path, ref status, ref statusHasValue); if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR) { @@ -367,7 +365,7 @@ private bool Init(string path, FileMode mode, FileAccess access, FileShare share if (_isLocked && ((options & FileOptions.DeleteOnClose) != 0) && share == FileShare.None && mode == FileMode.OpenOrCreate) { - FStatCheckIO(this, path, ref status, ref statusHasValue); + FStatCheckIO(path, ref status, ref statusHasValue); Interop.Sys.FileStatus pathStatus; if (Interop.Sys.Stat(path, out pathStatus) < 0) @@ -482,7 +480,7 @@ private bool CanLockTheFile(Interop.Sys.LockOperations lockOperation, FileAccess } } - private void FStatCheckIO(SafeFileHandle handle, string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue) + private void FStatCheckIO(string path, ref Interop.Sys.FileStatus status, ref bool statusHasValue) { if (!statusHasValue) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/ParserHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/ParserHelpers.cs index 46e39795302c3..7a25cbc607870 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/ParserHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/ParserHelpers.cs @@ -58,7 +58,7 @@ public static bool TryParseThrowFormatException(out T value, out int bytesCon // [DoesNotReturn] [StackTraceHidden] - public static bool TryParseThrowFormatException(ReadOnlySpan source, out T value, out int bytesConsumed) where T : struct + public static bool TryParseThrowFormatException(ReadOnlySpan _, out T value, out int bytesConsumed) where T : struct { // The parameters to this method are ordered the same as our callers' parameters // allowing the JIT to avoid unnecessary register swapping or spilling. diff --git a/src/libraries/System.Private.CoreLib/src/System/ByReference.cs b/src/libraries/System.Private.CoreLib/src/System/ByReference.cs index 64848ce992987..bb58fc3579a45 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ByReference.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ByReference.cs @@ -16,6 +16,7 @@ internal readonly ref struct ByReference private readonly IntPtr _value; #pragma warning restore CA1823, 169 +#pragma warning disable IDE0060 [Intrinsic] public ByReference(ref T value) { @@ -24,6 +25,7 @@ public ByReference(ref T value) // or if intrinsic is missed. throw new PlatformNotSupportedException(); } +#pragma warning restore IDE0060 #pragma warning disable CA1822 // Mark members as static public ref T Value diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs index 2a3d6995b7856..07f51d19e9508 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Hashtable.cs @@ -223,7 +223,7 @@ protected IComparer? comparer // Note: this constructor is a bogus constructor that does nothing // and is for use only with SyncHashtable. - internal Hashtable(bool trash) + internal Hashtable(bool _) { } diff --git a/src/libraries/System.Private.CoreLib/src/System/DateTime.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/DateTime.Unix.cs index 2fd3e7368e5f4..0c35b864ff4c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateTime.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateTime.Unix.cs @@ -15,10 +15,17 @@ public static DateTime UtcNow } } +#pragma warning disable IDE0060 + + // Never called private static DateTime FromFileTimeLeapSecondsAware(ulong fileTime) => default; + + // Never called private static ulong ToFileTimeLeapSecondsAware(long ticks) => default; // IsValidTimeWithLeapSeconds is not expected to be called at all for now on non-Windows platforms internal static bool IsValidTimeWithLeapSeconds(int year, int month, int day, int hour, int minute, DateTimeKind kind) => false; + +#pragma warning restore IDE0060 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs index 349d63b873669..32555bb77dd8d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs @@ -767,7 +767,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat // Return any exact bindings that may exist. (This method is not defined on the // Binder and is used by RuntimeType.) - public static MethodBase? ExactBinding(MethodBase[] match!!, Type[] types, ParameterModifier[]? modifiers) + public static MethodBase? ExactBinding(MethodBase[] match!!, Type[] types) { MethodBase[] aExactMatches = new MethodBase[match.Length]; int cExactMatches = 0; @@ -807,7 +807,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat // Return any exact bindings that may exist. (This method is not defined on the // Binder and is used by RuntimeType.) - public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match!!, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) + public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match!!, Type? returnType, Type[]? types) { PropertyInfo? bestMatch = null; int typesLength = (types != null) ? types.Length : 0; diff --git a/src/libraries/System.Private.CoreLib/src/System/Environment.NoRegistry.cs b/src/libraries/System.Private.CoreLib/src/System/Environment.NoRegistry.cs index fac6cf0fc5064..a9977ef2db04b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Environment.NoRegistry.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Environment.NoRegistry.cs @@ -9,10 +9,14 @@ public static partial class Environment { // Systems without the Windows registry pretend that it's always empty. +#pragma warning disable IDE0060 private static string? GetEnvironmentVariableFromRegistry(string variable, bool fromMachine) => null; +#pragma warning restore IDE0060 - private static void SetEnvironmentVariableFromRegistry(string variable, string? value, bool fromMachine) { } + static partial void SetEnvironmentVariableFromRegistry(string variable, string? value, bool fromMachine); +#pragma warning disable IDE0060 private static IDictionary GetEnvironmentVariablesFromRegistry(bool fromMachine) => new Hashtable(); +#pragma warning restore IDE0060 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs index 4faea9c957d0d..63e148d0c7c2b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs @@ -709,7 +709,7 @@ internal static long TimeToTicks(int hour, int minute, int second, int milliseco internal static int GetSystemTwoDigitYearSetting(CalendarId CalID, int defaultYearValue) { - int twoDigitYearMax = GlobalizationMode.UseNls ? CalendarData.NlsGetTwoDigitYearMax(CalID) : CalendarData.IcuGetTwoDigitYearMax(CalID); + int twoDigitYearMax = GlobalizationMode.UseNls ? CalendarData.NlsGetTwoDigitYearMax(CalID) : CalendarData.IcuGetTwoDigitYearMax(); return twoDigitYearMax >= 0 ? twoDigitYearMax : defaultYearValue; } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs index a29b249ea668b..ee2c509a0e480 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs @@ -81,7 +81,7 @@ private bool IcuLoadCalendarDataFromSystem(string localeName, CalendarId calenda return result; } - internal static int IcuGetTwoDigitYearMax(CalendarId calendarId) + internal static int IcuGetTwoDigitYearMax() { Debug.Assert(!GlobalizationMode.UseNls); diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Unix.cs index 22f473247620e..fede23f8e2576 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Unix.cs @@ -8,7 +8,9 @@ internal sealed partial class CalendarData private bool LoadCalendarDataFromSystemCore(string localeName, CalendarId calendarId) => IcuLoadCalendarDataFromSystem(localeName, calendarId); +#pragma warning disable IDE0060 internal static int GetCalendarsCore(string localeName, bool useUserOverride, CalendarId[] calendars) => IcuGetCalendars(localeName, calendars); +#pragma warning restore IDE0060 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs index 85bf08e06095a..7505201d3576e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs @@ -209,7 +209,7 @@ private unsafe string IcuGetTimeFormatString(bool shortFormat) } // no support to lookup by region name, other than the hard-coded list in CultureData - private static CultureData? IcuGetCultureDataFromRegionName(string? regionName) => null; + private static CultureData? IcuGetCultureDataFromRegionName() => null; private string IcuGetLanguageDisplayName(string cultureName) => IcuGetLocaleInfo(cultureName, LocaleStringData.LocalizedDisplayName, CultureInfo.CurrentUICulture.Name); diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Unix.cs index fd59f95c76d50..2a253d5367be3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Unix.cs @@ -9,11 +9,8 @@ internal sealed partial class CultureData { private bool InitCultureDataCore() => InitIcuCultureDataCore(); - private void InitUserOverride(bool useUserOverride) - { - // Unix doesn't support user overrides - _bUseOverrides = false; - } + // Unix doesn't support user overrides + partial void InitUserOverride(bool useUserOverride); private static string? LCIDToLocaleName(int culture) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs index bdee108ba076f..8067feb448b6d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs @@ -475,7 +475,7 @@ internal sealed partial class CultureData // If not found in the hard coded table we'll have to find a culture that works for us if (!GlobalizationMode.Invariant && (retVal == null || retVal.IsNeutralCulture)) { - retVal = GlobalizationMode.UseNls ? NlsGetCultureDataFromRegionName(cultureName) : IcuGetCultureDataFromRegionName(cultureName); + retVal = GlobalizationMode.UseNls ? NlsGetCultureDataFromRegionName(cultureName) : IcuGetCultureDataFromRegionName(); } // If we found one we can use, then cache it for next time diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs index e993a17abba24..a74b448775c62 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeParse.cs @@ -5223,10 +5223,12 @@ private static string Hex(char c) return "\\u" + ((int)c).ToString("x4", CultureInfo.InvariantCulture); } +#pragma warning disable IDE0060 private static void Trace(string s) { - // Internal.Console.WriteLine(s); + //Internal.Console.WriteLine(s); } +#pragma warning restore IDE0060 // for testing; do not make this readonly private static bool s_tracingEnabled; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs index dab107f1aa732..f3b44bcbbac3c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs @@ -39,6 +39,7 @@ public static void CopyFile(string sourceFullPath, string destFullPath, bool ove } } +#pragma warning disable IDE0060 public static void Encrypt(string path) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_FileEncryption); @@ -48,6 +49,7 @@ public static void Decrypt(string path) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_FileEncryption); } +#pragma warning restore IDE0060 private static void LinkOrCopyFile (string sourceFullPath, string destFullPath) { @@ -106,8 +108,8 @@ private static void LinkOrCopyFile (string sourceFullPath, string destFullPath) } } - - public static void ReplaceFile(string sourceFullPath, string destFullPath, string? destBackupFullPath, bool ignoreMetadataErrors) +#pragma warning disable IDE0060 + public static void ReplaceFile(string sourceFullPath, string destFullPath, string? destBackupFullPath, bool ignoreMetadataErrors /* unused */) { // Unix rename works in more cases, we limit to what is allowed by Windows File.Replace. // These checks are not atomic, the file could change after a check was performed and before it is renamed. @@ -172,6 +174,7 @@ public static void ReplaceFile(string sourceFullPath, string destFullPath, strin // Finally, rename the source to the destination, overwriting the destination. Interop.CheckIo(Interop.Sys.Rename(sourceFullPath, destFullPath)); } +#pragma warning restore IDE0060 public static void MoveFile(string sourceFullPath, string destFullPath) { @@ -597,7 +600,9 @@ public static string[] GetLogicalDrives() return DriveInfoInternal.GetLogicalDrives(); } +#pragma warning disable IDE0060 internal static string? GetLinkTarget(ReadOnlySpan linkPath, bool isDirectory) => Interop.Sys.ReadLink(linkPath); +#pragma warning restore IDE0060 internal static void CreateSymbolicLink(string path, string pathToTarget, bool isDirectory) { @@ -610,7 +615,7 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i ValueStringBuilder sb = new(Interop.DefaultPathBufferSize); sb.Append(linkPath); - string? linkTarget = GetLinkTarget(linkPath, isDirectory: false /* Irrelevant in Unix */); + string? linkTarget = Interop.Sys.ReadLink(linkPath); if (linkTarget == null) { sb.Dispose(); @@ -643,7 +648,7 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i } GetLinkTargetFullPath(ref sb, current); - current = GetLinkTarget(sb.AsSpan(), isDirectory: false); + current = Interop.Sys.ReadLink(sb.AsSpan()); visitCount++; } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs index a0aa31bb89713..b14be8880fed9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Unix.cs @@ -8,8 +8,10 @@ namespace System.IO.Strategies // this type defines a set of stateless FileStream/FileStreamStrategy helper methods internal static partial class FileStreamHelpers { +#pragma warning disable IDE0060 private static OSFileStreamStrategy ChooseStrategyCore(SafeFileHandle handle, FileAccess access, bool isAsync) => new UnixFileStreamStrategy(handle, access); +#pragma warning restore IDE0060 private static FileStreamStrategy ChooseStrategyCore(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize) => new UnixFileStreamStrategy(path, mode, access, share, options, preallocationSize); @@ -28,7 +30,7 @@ internal static long CheckFileCall(long result, string? path, bool ignoreNotSupp return result; } - internal static long Seek(SafeFileHandle handle, long offset, SeekOrigin origin, bool closeInvalidHandle = false) => + internal static long Seek(SafeFileHandle handle, long offset, SeekOrigin origin) => CheckFileCall(Interop.Sys.LSeek(handle, offset, (Interop.Sys.SeekWhence)(int)origin), handle.Path); // SeekOrigin values are the same as Interop.libc.SeekWhence values internal static void ThrowInvalidArgument(SafeFileHandle handle) => diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs index 020d270b9fbb0..8b45db60ec5a3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs @@ -32,7 +32,7 @@ protected ResourceSet() // For RuntimeResourceSet, ignore the Table parameter - it's a wasted // allocation. - internal ResourceSet(bool junk) + internal ResourceSet(bool _) { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 68e96db5cc268..c1a77c2241c7c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -116,11 +116,12 @@ internal static bool IsPrimitiveType(this CorElementType et) // The following intrinsics return true if input is a compile-time constant // Feel free to add more overloads on demand - +#pragma warning disable IDE0060 [Intrinsic] internal static bool IsKnownConstant(string? t) => false; [Intrinsic] internal static bool IsKnownConstant(char t) => false; +#pragma warning restore IDE0060 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs index 5a28db6ff101d..492a3620606a5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs @@ -162,6 +162,7 @@ public static int GetEndComSlot(Type t) throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } +#pragma warning disable IDE0060 internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError) { if (throwOnError) @@ -169,6 +170,7 @@ public static int GetEndComSlot(Type t) return null; } +#pragma warning restore IDE0060 [SupportedOSPlatform("windows")] public static string GetTypeInfoName(ITypeInfo typeInfo) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Unix.cs index b613fc8cd7ebb..c32d0cd2d6edb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Unix.cs @@ -160,6 +160,7 @@ public static unsafe void FreeBSTR(IntPtr ptr) } } +#pragma warning disable IDE0060 internal static Type? GetTypeFromProgID(string progID!!, string? server, bool throwOnError) { if (throwOnError) @@ -167,6 +168,7 @@ public static unsafe void FreeBSTR(IntPtr ptr) return null; } +#pragma warning restore IDE0060 /// /// Get the last system error on the current thread diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs index 20a04f0e161ca..9dd7d74837068 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs @@ -619,6 +619,7 @@ public static IntPtr GetHINSTANCE(Module m) } #if !CORECLR +#pragma warning disable IDE0060 private static Exception? GetExceptionForHRInternal(int errorCode, IntPtr errorInfo) { switch (errorCode) @@ -848,6 +849,7 @@ public static IntPtr GetHINSTANCE(Module m) return new COMException("", errorCode); } } +#pragma warning restore IDE0060 #endif /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs index cf1efef3fab2e..6b183f0aa41b2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Unix.cs @@ -15,7 +15,7 @@ internal partial struct LibraryNameVariation private const string LibraryNameSuffix = ".so"; #endif - internal static IEnumerable DetermineLibraryNameVariations(string libName, bool isRelativePath, bool forOSLoader = false) + internal static IEnumerable DetermineLibraryNameVariations(string libName, bool isRelativePath) { // This is a copy of the logic in DetermineLibNameVariations in dllimport.cpp in CoreCLR diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Windows.cs index a62fbb28ef35d..bbc4aacc08e49 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/LibraryNameVariation.Windows.cs @@ -9,7 +9,7 @@ internal partial struct LibraryNameVariation { private const string LibraryNameSuffix = ".dll"; - internal static IEnumerable DetermineLibraryNameVariations(string libName, bool isRelativePath, bool forOSLoader = false) + internal static IEnumerable DetermineLibraryNameVariations(string libName, bool isRelativePath) { // This is a copy of the logic in DetermineLibNameVariations in dllimport.cpp in CoreCLR @@ -17,7 +17,6 @@ internal static IEnumerable DetermineLibraryNameVariations // Follow LoadLibrary rules if forOSLoader is true if (isRelativePath && - (!forOSLoader || libName.Contains('.') && !libName.EndsWith('.')) && !libName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && !libName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Unix.cs index 6fd120d9386be..2f0cb43e786f5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Unix.cs @@ -20,6 +20,7 @@ private static bool CheckForAvailableMemory(out ulong availPageFile, out ulong t return false; } +#pragma warning disable IDE0060 // 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 @@ -35,5 +36,6 @@ private static void GrowPageFileIfNecessaryAndPossible(UIntPtr numBytes) { // Unreachable until CheckForAvailableMemory is implemented } +#pragma warning restore IDE0060 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.cs index caa22ddd23eb9..79535d873867d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.cs @@ -286,7 +286,7 @@ public MemoryFailPoint(int sizeInMegabytes) ~MemoryFailPoint() { - Dispose(false); + Disposing(); } // Applications must call Dispose, which conceptually "releases" the @@ -298,11 +298,11 @@ public MemoryFailPoint(int sizeInMegabytes) // memory, apps will help their performance greatly by calling Dispose. public void Dispose() { - Dispose(true); + Disposing(); GC.SuppressFinalize(this); } - private void Dispose(bool disposing) + private void Disposing() { // This is just bookkeeping to ensure multiple threads can really // get enough memory, and this does not actually reserve memory diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/Rune.cs b/src/libraries/System.Private.CoreLib/src/System/Text/Rune.cs index ee364f6ac9e27..b4e226b64d1fb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/Rune.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/Rune.cs @@ -112,7 +112,7 @@ public Rune(uint value) } // non-validating ctor - private Rune(uint scalarValue, bool unused) + private Rune(uint scalarValue, bool _) { UnicodeDebug.AssertIsValidScalar(scalarValue); _value = scalarValue; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Unix.cs index eb9b4b171d413..bb7db725084c8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/EventWaitHandle.Unix.cs @@ -19,10 +19,12 @@ private void CreateEventCore(bool initialState, EventResetMode mode, string? nam createdNew = true; } +#pragma warning disable IDE0060 private static OpenExistingResult OpenExistingWorker(string name, out EventWaitHandle? result) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives); } +#pragma warning restore IDE0060 public bool Reset() { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Unix.cs index 61975a86ebb3f..bb2a1d6441645 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Semaphore.Unix.cs @@ -21,10 +21,12 @@ private void CreateSemaphoreCore(int initialCount, int maximumCount, string? nam createdNew = true; } +#pragma warning disable IDE0060 private static OpenExistingResult OpenExistingWorker(string name, out Semaphore? result) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives); } +#pragma warning restore IDE0060 private int ReleaseCore(int releaseCount) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Portable.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Portable.cs index 34e0ab1f6ec24..6a2af49dc19d8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Portable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Portable.cs @@ -34,10 +34,14 @@ public static partial class ThreadPool // Threadpool specific initialization of a new thread. Used by OS-provided threadpools. No-op for portable threadpool. internal static void InitializeForThreadPoolThread() { } +#pragma warning disable IDE0060 internal static bool CanSetMinIOCompletionThreads(int ioCompletionThreads) => true; - internal static void SetMinIOCompletionThreads(int ioCompletionThreads) { } - internal static bool CanSetMaxIOCompletionThreads(int ioCompletionThreads) => true; +#pragma warning restore IDE0060 + + [Conditional("unnecessary")] + internal static void SetMinIOCompletionThreads(int ioCompletionThreads) { } + [Conditional("unnecessary")] internal static void SetMaxIOCompletionThreads(int ioCompletionThreads) { } public static bool SetMaxThreads(int workerThreads, int completionPortThreads) => @@ -92,7 +96,9 @@ public static void GetAvailableThreads(out int workerThreads, out int completion /// /// CPU utilization as a percentage since the last call /// True if the runtime still needs to perform gate activities, false otherwise +#pragma warning disable IDE0060 internal static bool PerformRuntimeSpecificGateActivities(int cpuUtilization) => false; +#pragma warning restore IDE0060 internal static void NotifyWorkItemProgress() => PortableThreadPool.ThreadPoolInstance.NotifyWorkItemProgress(); diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.Portable.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.Portable.cs index c1e8918803e7e..f53047e3f692a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.Portable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/TimerQueue.Portable.cs @@ -23,9 +23,11 @@ internal sealed partial class TimerQueue : IThreadPoolWorkItem private bool _isScheduled; private long _scheduledDueTimeMs; +#pragma warning disable IDE0060 private TimerQueue(int id) { } +#pragma warning restore IDE0060 private static List InitializeScheduledTimerManager_Locked() { diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs index e0c284b6c5352..2b381382072e7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs @@ -59,11 +59,13 @@ private static string GetUtcStandardDisplayName() return standardDisplayName; } +#pragma warning disable IDE0060 // Helper function to get the full display name for the UTC static time zone instance private static string GetUtcFullDisplayName(string timeZoneId, string standardDisplayName) { return $"(UTC) {standardDisplayName}"; } +#pragma warning restore IDE0060 // Helper function that retrieves various forms of time zone display names from ICU private static unsafe void GetDisplayName(string timeZoneId, Interop.Globalization.TimeZoneDisplayNameType nameType, string uiCulture, ref string? displayName) diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs index 9f4905e511b12..e989e9c92bd45 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs @@ -54,14 +54,12 @@ private TimeZoneInfo(byte[] data, string id, bool dstDisabled) byte[] typeOfLocalTime; TZifType[] transitionType; string zoneAbbreviations; - bool[] StandardTime; - bool[] GmtTime; string? futureTransitionsPosixFormat; string? standardAbbrevName = null; string? daylightAbbrevName = null; // parse the raw TZif bytes; this method can throw ArgumentException when the data is malformed. - TZif_ParseRaw(data, out t, out dts, out typeOfLocalTime, out transitionType, out zoneAbbreviations, out StandardTime, out GmtTime, out futureTransitionsPosixFormat); + TZif_ParseRaw(data, out t, out dts, out typeOfLocalTime, out transitionType, out zoneAbbreviations, out futureTransitionsPosixFormat); // find the best matching baseUtcOffset and display strings based on the current utcNow value. // NOTE: read the Standard and Daylight display strings from the tzfile now in case they can't be loaded later @@ -118,7 +116,7 @@ private TimeZoneInfo(byte[] data, string id, bool dstDisabled) if (!dstDisabled) { // only create the adjustment rule if DST is enabled - TZif_GenerateAdjustmentRules(out _adjustmentRules, _baseUtcOffset, dts, typeOfLocalTime, transitionType, StandardTime, GmtTime, futureTransitionsPosixFormat); + TZif_GenerateAdjustmentRules(out _adjustmentRules, _baseUtcOffset, dts, typeOfLocalTime, transitionType, futureTransitionsPosixFormat); } ValidateTimeZoneInfo(_id, _baseUtcOffset, _adjustmentRules, out _supportsDaylightSavingTime); @@ -464,7 +462,7 @@ internal static TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool // // private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, TimeSpan baseUtcOffset, DateTime[] dts, byte[] typeOfLocalTime, - TZifType[] transitionType, bool[] StandardTime, bool[] GmtTime, string? futureTransitionsPosixFormat) + TZifType[] transitionType, string? futureTransitionsPosixFormat) { rules = null; @@ -475,7 +473,7 @@ private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, Ti while (index <= dts.Length) { - TZif_GenerateAdjustmentRule(ref index, baseUtcOffset, rulesList, dts, typeOfLocalTime, transitionType, StandardTime, GmtTime, futureTransitionsPosixFormat); + TZif_GenerateAdjustmentRule(ref index, baseUtcOffset, rulesList, dts, typeOfLocalTime, transitionType, futureTransitionsPosixFormat); } rules = rulesList.ToArray(); @@ -487,7 +485,7 @@ private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, Ti } private static void TZif_GenerateAdjustmentRule(ref int index, TimeSpan timeZoneBaseUtcOffset, List rulesList, DateTime[] dts, - byte[] typeOfLocalTime, TZifType[] transitionTypes, bool[] StandardTime, bool[] GmtTime, string? futureTransitionsPosixFormat) + byte[] typeOfLocalTime, TZifType[] transitionTypes, string? futureTransitionsPosixFormat) { // To generate AdjustmentRules, use the following approach: // The first AdjustmentRule will go from DateTime.MinValue to the first transition time greater than DateTime.MinValue. @@ -1114,7 +1112,7 @@ private static DateTime TZif_UnixTimeToDateTime(long unixTime) => DateTimeOffset.FromUnixTimeSeconds(unixTime).UtcDateTime; private static void TZif_ParseRaw(byte[] data, out TZifHead t, out DateTime[] dts, out byte[] typeOfLocalTime, out TZifType[] transitionType, - out string zoneAbbreviations, out bool[] StandardTime, out bool[] GmtTime, out string? futureTransitionsPosixFormat) + out string zoneAbbreviations, out string? futureTransitionsPosixFormat) { futureTransitionsPosixFormat = null; @@ -1140,8 +1138,6 @@ private static void TZif_ParseRaw(byte[] data, out TZifHead t, out DateTime[] dt dts = new DateTime[t.TimeCount]; typeOfLocalTime = new byte[t.TimeCount]; transitionType = new TZifType[t.TypeCount]; - StandardTime = new bool[t.TypeCount]; - GmtTime = new bool[t.TypeCount]; // read in the UTC transition points and convert them to Windows // @@ -1191,10 +1187,7 @@ private static void TZif_ParseRaw(byte[] data, out TZifHead t, out DateTime[] dt // FALSE = transition time is wall clock time // ABSENT = transition time is wall clock time // - for (int i = 0; i < t.IsStdCount && i < t.TypeCount && index < data.Length; i++) - { - StandardTime[i] = (data[index++] != 0); - } + index += (int)Math.Min(t.IsStdCount, t.TypeCount); // read in the GMT Time table. There should be a 1:1 mapping between Type-Index and GMT Time table // entries. @@ -1203,10 +1196,7 @@ private static void TZif_ParseRaw(byte[] data, out TZifHead t, out DateTime[] dt // FALSE = transition time is local time // ABSENT = transition time is local time // - for (int i = 0; i < t.IsGmtCount && i < t.TypeCount && index < data.Length; i++) - { - GmtTime[i] = (data[index++] != 0); - } + index += (int)Math.Min(t.IsGmtCount, t.TypeCount); if (t.Version != TZVersion.V1) { diff --git a/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs index cb1bd0d52d26b..d7fc8ed5aa294 100644 --- a/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs @@ -538,12 +538,12 @@ internal void InternalArray__ICollection_Clear() ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection); } - internal void InternalArray__ICollection_Add(T item) + internal void InternalArray__ICollection_Add(T _) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } - internal bool InternalArray__ICollection_Remove(T item) + internal bool InternalArray__ICollection_Remove(T _) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); return default; @@ -575,12 +575,12 @@ internal int InternalArray__IReadOnlyCollection_get_Count() return Length; } - internal void InternalArray__Insert(int index, T item) + internal void InternalArray__Insert(int _, T _1) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } - internal void InternalArray__RemoveAt(int index) + internal void InternalArray__RemoveAt(int _) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } diff --git a/src/mono/System.Private.CoreLib/src/System/Diagnostics/StackFrame.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Diagnostics/StackFrame.Mono.cs index c4d73bb865da0..0251fe2d6f011 100644 --- a/src/mono/System.Private.CoreLib/src/System/Diagnostics/StackFrame.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Diagnostics/StackFrame.Mono.cs @@ -45,7 +45,9 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo) } } +#pragma warning disable IDE0060 private static bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false; +#pragma warning restore IDE0060 [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool get_frame_info(int skipFrames, bool needFileInfo, diff --git a/src/mono/System.Private.CoreLib/src/System/IO/FileLoadException.Mono.cs b/src/mono/System.Private.CoreLib/src/System/IO/FileLoadException.Mono.cs index e0c8ed4c89953..b6b7a9c028ca9 100644 --- a/src/mono/System.Private.CoreLib/src/System/IO/FileLoadException.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/IO/FileLoadException.Mono.cs @@ -5,9 +5,11 @@ namespace System.IO { public partial class FileLoadException { +#pragma warning disable IDE0060 internal static string FormatFileLoadExceptionMessage(string? fileName, int hResult) { return ""; } +#pragma warning restore IDE0060 } } diff --git a/src/mono/System.Private.CoreLib/src/System/MissingMemberException.Mono.cs b/src/mono/System.Private.CoreLib/src/System/MissingMemberException.Mono.cs index 4d604107756e3..be56bc7fe746a 100644 --- a/src/mono/System.Private.CoreLib/src/System/MissingMemberException.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/MissingMemberException.Mono.cs @@ -5,9 +5,11 @@ namespace System { public partial class MissingMemberException { +#pragma warning disable IDE0060 internal static string FormatSignature(byte[] signature) { return ""; } +#pragma warning restore IDE0060 } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs index b66f7d9b89704..fef4faf605f1b 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs @@ -227,7 +227,7 @@ private AssemblyBuilder(AssemblyName n, AssemblyBuilderAccess access) basic_init(this); // Netcore only allows one module per assembly - manifest_module = new ModuleBuilder(this, "RefEmit_InMemoryManifestModule", false); + manifest_module = new ModuleBuilder(this, "RefEmit_InMemoryManifestModule"); modules = new ModuleBuilder[] { manifest_module }; } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs index 2eb1774be89b2..ce0837233379d 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.Mono.cs @@ -78,7 +78,7 @@ internal ConstructorBuilder(TypeBuilder tb, MethodAttributes attributes, Calling type = tb; this.paramModReq = paramModReq; this.paramModOpt = paramModOpt; - table_idx = get_next_table_index(this, 0x06, 1); + table_idx = get_next_table_index(0x06, 1); ((ModuleBuilder)tb.Module).RegisterToken(this, MetadataToken); } @@ -348,9 +348,9 @@ internal void ResolveUserTypes() } } - internal override int get_next_table_index(object obj, int table, int count) + internal override int get_next_table_index(int table, int count) { - return type.get_next_table_index(obj, table, count); + return type.get_next_table_index(table, count); } private void RejectIfCreated() diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs index 5865a42bd77f5..2f546df6acd3d 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.Mono.cs @@ -62,12 +62,12 @@ internal EventBuilder(TypeBuilder tb, string eventName, EventAttributes eventAtt attrs = eventAttrs; type = eventType; typeb = tb; - table_idx = get_next_table_index(this, 0x14, 1); + table_idx = get_next_table_index(0x14, 1); } - internal int get_next_table_index(object obj, int table, int count) + internal int get_next_table_index(int table, int count) { - return typeb.get_next_table_index(obj, table, count); + return typeb.get_next_table_index(table, count); } public void AddOtherMethod(MethodBuilder mdBuilder) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs index d090eaca09f16..40b157c5b3e9d 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.Mono.cs @@ -99,7 +99,7 @@ internal MethodBuilder(TypeBuilder tb, string name, MethodAttributes attributes, Array.Copy(parameterTypes, this.parameters, parameterTypes.Length); } type = tb; - table_idx = get_next_table_index(this, 0x06, 1); + table_idx = get_next_table_index(0x06, 1); ((ModuleBuilder)tb.Module).RegisterToken(this, MetadataToken); } @@ -505,9 +505,9 @@ public override int GetHashCode() return name.GetHashCode(); } - internal override int get_next_table_index(object obj, int table, int count) + internal override int get_next_table_index(int table, int count) { - return type.get_next_table_index(obj, table, count); + return type.get_next_table_index(table, count); } private static void ExtendArray([NotNull] ref T[]? array, T elem) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs index 1115440ac1f68..ab27187ce0b82 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs @@ -87,13 +87,13 @@ public partial class ModuleBuilder : Module private static extern void set_wrappers_type(ModuleBuilder mb, Type? ab); [DynamicDependency(nameof(table_indexes))] // Automatically keeps all previous fields too due to StructLayout - internal ModuleBuilder(AssemblyBuilder assb, string name, bool emitSymbolInfo) + internal ModuleBuilder(AssemblyBuilder assb, string name) { this.name = this.scopename = name; this.fqname = name; this.assembly = this.assemblyb = assb; guid = Guid.NewGuid().ToByteArray(); - table_idx = get_next_table_index(this, 0x00, 1); + table_idx = get_next_table_index(0x00, 1); name_cache = new Dictionary(); us_string_cache = new Dictionary(512); @@ -466,7 +466,7 @@ public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type under return result; } - internal int get_next_table_index(object obj, int table, int count) + internal int get_next_table_index(int table, int count) { if (table_indexes == null) { diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.Mono.cs index 337fd78991bda..11abfa207e419 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.Mono.cs @@ -64,7 +64,7 @@ internal ParameterBuilder(MethodBase mb, int pos, ParameterAttributes attributes if (mb is DynamicMethod) table_idx = 0; else - table_idx = mb.get_next_table_index(this, 0x08, 1); + table_idx = mb.get_next_table_index(0x08, 1); } public virtual int Attributes diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs index d24191a1719c0..40c8b7408cc53 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.Mono.cs @@ -77,7 +77,7 @@ internal PropertyBuilder(TypeBuilder tb, string name, PropertyAttributes attribu Array.Copy(parameterTypes, this.parameters, this.parameters.Length); } typeb = tb; - table_idx = tb.get_next_table_index(this, 0x17, 1); + table_idx = tb.get_next_table_index(0x17, 1); } public override PropertyAttributes Attributes diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs index 674fadb7a2f9f..2d4a277d79ac1 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.Mono.cs @@ -145,7 +145,7 @@ internal TypeBuilder(ModuleBuilder mb, string fullname, TypeAttributes attr, [Dy this.parent = typeof(object); // skip . ? - table_idx = mb.get_next_table_index(this, 0x02, 1); + table_idx = mb.get_next_table_index(0x02, 1); this.fullname = GetFullName(); } @@ -1641,9 +1641,9 @@ public void SetParent([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes this.parent = ResolveUserType(this.parent); } - internal int get_next_table_index(object obj, int table, int count) + internal int get_next_table_index(int table, int count) { - return pmodule.get_next_table_index(obj, table, count); + return pmodule.get_next_table_index(table, count); } [ComVisible(true)] diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBase.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBase.Mono.cs index de50a21603cc7..3b92f8d5ad792 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBase.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/MethodBase.Mono.cs @@ -70,7 +70,7 @@ internal virtual Type[] GetParameterTypes() return parameterTypes; } - internal virtual int get_next_table_index(object obj, int table, int count) + internal virtual int get_next_table_index(int table, int count) { throw new NotImplementedException(); } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs index 7946ad08d88af..b375ae9af1248 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs @@ -180,7 +180,7 @@ private string FormatNameAndSig() StringBuilder sbName = new StringBuilder(Name); if (IsGenericMethod) - sbName.Append(RuntimeMethodHandle.ConstructInstantiation(this, TypeNameFormatFlags.FormatBasic)); + sbName.Append(RuntimeMethodHandle.ConstructInstantiation(this)); sbName.Append('('); RuntimeParameterInfo.FormatParameters(sbName, GetParametersNoCopy(), CallingConvention); @@ -211,7 +211,7 @@ public override string ToString() sbName.Append(Name); if (IsGenericMethod) - sbName.Append(RuntimeMethodHandle.ConstructInstantiation(this, TypeNameFormatFlags.FormatBasic)); + sbName.Append(RuntimeMethodHandle.ConstructInstantiation(this)); sbName.Append('('); AppendParameters(ref sbName, GetParameterTypes(), CallingConvention); diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs index 49b93940f4034..4e3ae13938785 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs @@ -352,7 +352,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit) return getter((T)obj!); } - private static object? StaticGetterAdapterFrame(StaticGetter getter, object? obj) + private static object? StaticGetterAdapterFrame(StaticGetter getter, object? _) { return getter(); } diff --git a/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/JitHelpers.cs b/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/JitHelpers.cs index 791aae4af8f74..7dbf6f02b5bc9 100644 --- a/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/JitHelpers.cs +++ b/src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/JitHelpers.cs @@ -5,10 +5,12 @@ namespace System.Runtime.CompilerServices { internal static class JitHelpers { +#pragma warning disable IDE0060 [Intrinsic] public static bool EnumEquals(T x, T y) where T : struct, Enum => throw new NotImplementedException(); [Intrinsic] public static int EnumCompareTo(T x, T y) where T : struct, Enum => throw new NotImplementedException(); +#pragma warning restore IDE0060 } } diff --git a/src/mono/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.Mono.cs index d01e69ac190b5..ef322b9fe2bd0 100644 --- a/src/mono/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.Mono.cs @@ -9,6 +9,7 @@ namespace System.Runtime.InteropServices.ObjectiveC { public static partial class ObjectiveCMarshal { +#pragma warning disable IDE0060 // Remove when implemented /// /// Sets a pending exception to be thrown the next time the runtime is entered from an Objective-C msgSend P/Invoke. /// diff --git a/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs index f646ccb652f0b..32924c5486dbd 100644 --- a/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs @@ -36,6 +36,7 @@ private IntPtr InitializeAssemblyLoadContext(IntPtr thisHandlePtr, bool represen [RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")] [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod +#pragma warning disable IDE0060 private Assembly InternalLoadFromPath(string? assemblyPath, string? nativeImagePath) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; @@ -44,6 +45,7 @@ private Assembly InternalLoadFromPath(string? assemblyPath, string? nativeImageP // TODO: Handle nativeImagePath return InternalLoadFile(NativeALC, assemblyPath, ref stackMark); } +#pragma warning restore IDE0060 [RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")] internal Assembly InternalLoad(byte[] arrAssembly, byte[]? arrSymbols) diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs index 8b0a887f64ebe..10fe3699d2876 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs @@ -71,7 +71,7 @@ public override int GetHashCode() [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void SetValueInternal(FieldInfo fi, object? obj, object? value); - internal static void SetValue(RuntimeFieldInfo field, object? obj, object? value, RuntimeType? fieldType, FieldAttributes fieldAttr, RuntimeType? declaringType, ref bool domainInitialized) + internal static void SetValue(RuntimeFieldInfo field, object? obj, object? value, RuntimeType? _, FieldAttributes _1, RuntimeType? _2, ref bool _3) { SetValueInternal(field, obj, value); } diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs index dec0bab5a592e..2f0e1b726082f 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs @@ -66,7 +66,7 @@ public override int GetHashCode() return !left.Equals(right); } - internal static string ConstructInstantiation(RuntimeMethodInfo method, TypeNameFormatFlags format) + internal static string ConstructInstantiation(RuntimeMethodInfo method) { var sb = new StringBuilder(); Type[]? gen_params = method.GetGenericArguments(); diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index 095d82d13659b..3d98641c16075 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -151,7 +151,7 @@ public void Add(T item) throw new ArgumentNullException(nameof(typeName)); return RuntimeTypeHandle.GetTypeByName( - typeName, throwOnError, ignoreCase, ref stackMark, false); + typeName, throwOnError, ignoreCase, ref stackMark); } private static void SplitName(string? fullname, out string? name, out string? ns) @@ -833,7 +833,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo; + return System.DefaultBinder.ExactBinding(candidates.ToArray(), types) as ConstructorInfo; if (binder == null) binder = DefaultBinder; @@ -873,7 +873,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) } if ((bindingAttr & BindingFlags.ExactBinding) != 0) - return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers); + return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types); if (binder == null) binder = DefaultBinder; diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs index 3c677d5268865..0a2ddac541b36 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeTypeHandle.cs @@ -231,16 +231,13 @@ internal static bool IsComObject(RuntimeType type, bool isGenericCOM) return isGenericCOM ? false : IsComObject(new QCallTypeHandle(ref type)); } - internal static bool IsContextful(RuntimeType type) - { - return false; - } - +#pragma warning disable IDE0060 internal static bool IsEquivalentTo(RuntimeType rtType1, RuntimeType rtType2) { // refence check is done earlier and we don't recognize anything else return false; } +#pragma warning restore IDE0060 internal static bool IsInterface(RuntimeType type) { @@ -364,8 +361,7 @@ internal static bool IsTypeDefinition(RuntimeType type) private static extern void internal_from_name(IntPtr name, ref StackCrawlMark stackMark, ObjectHandleOnStack res, bool throwOnError, bool ignoreCase); [RequiresUnreferencedCode("Types might be removed")] - internal static RuntimeType? GetTypeByName(string typeName, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark, - bool loadTypeFromPartialName) + internal static RuntimeType? GetTypeByName(string typeName, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark) { if (typeName == null) throw new ArgumentNullException(nameof(typeName)); diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.Unix.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.Unix.Mono.cs index bbb9c407786c0..180f802ed84ca 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.Unix.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/LowLevelLifoSemaphore.Unix.Mono.cs @@ -12,10 +12,12 @@ internal sealed unsafe partial class LowLevelLifoSemaphore : IDisposable [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern IntPtr InitInternal(); +#pragma warning disable IDE0060 private void Create(int maximumSignalCount) { lifo_semaphore = InitInternal(); } +#pragma warning restore IDE0060 [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void DeleteInternal(IntPtr semaphore); diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.cs b/src/mono/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.cs index a1d410e30bd53..caad4d140aa40 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.cs @@ -10,6 +10,5 @@ public PreAllocatedOverlapped(IOCompletionCallback callback, object? state, obje [CLSCompliantAttribute(false)] public static PreAllocatedOverlapped UnsafeCreate(IOCompletionCallback callback, object? state, object? pinData) => new PreAllocatedOverlapped(callback, state, pinData); public void Dispose() { } - internal bool IsUserObject(byte[]? buffer) => false; } } diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Mono.cs index 15aabc85edf74..067b197071868 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Mono.cs @@ -3,11 +3,13 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; +using System.Diagnostics; namespace System.Threading { public static partial class ThreadPool { + [Conditional("unnecessary")] internal static void ReportThreadStatus(bool isWorking) { } diff --git a/src/tasks/Crossgen2Tasks/PrepareForReadyToRunCompilation.cs b/src/tasks/Crossgen2Tasks/PrepareForReadyToRunCompilation.cs index 42fca5546a7a4..f035a5617bb1c 100644 --- a/src/tasks/Crossgen2Tasks/PrepareForReadyToRunCompilation.cs +++ b/src/tasks/Crossgen2Tasks/PrepareForReadyToRunCompilation.cs @@ -417,7 +417,7 @@ private static Eligibility GetInputFileEligibility(ITaskItem file, bool composit } // save these most expensive checks for last. We don't want to scan all references for IL code - if (ReferencesWinMD(mdReader) || !HasILCode(pereader, mdReader)) + if (ReferencesWinMD(mdReader) || !HasILCode(mdReader)) { // Forwarder assemblies are not separately compiled via R2R, but when performing composite compilation, they are included in the bundle if (excludeFromComposite || !compositeCompile) @@ -488,7 +488,7 @@ private static bool ReferencesWinMD(MetadataReader mdReader) return false; } - private static bool HasILCode(PEReader peReader, MetadataReader mdReader) + private static bool HasILCode(MetadataReader mdReader) { foreach (var methoddefHandle in mdReader.MethodDefinitions) {