Skip to content

Commit 8d36839

Browse files
committed
Enable IDE0060 (Remove unused parameter) analyzer
1 parent 6d18b06 commit 8d36839

421 files changed

Lines changed: 1406 additions & 1723 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eng/CodeAnalysis.src.globalconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ dotnet_diagnostic.IDE0058.severity = silent
14631463
dotnet_diagnostic.IDE0059.severity = warning
14641464

14651465
# IDE0060: Remove unused parameter
1466-
dotnet_diagnostic.IDE0060.severity = silent
1466+
dotnet_diagnostic.IDE0060.severity = warning
14671467
dotnet_code_quality_unused_parameters = non_public
14681468

14691469
# IDE0061: Use expression body for local functions

src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,10 @@ public static string GetTypeInfoName(ITypeInfo typeInfo!!)
300300
return strTypeLibName;
301301
}
302302

303+
#pragma warning disable IDE0060
303304
// This method is identical to Type.GetTypeFromCLSID. Since it's interop specific, we expose it
304305
// on Marshal for more consistent API surface.
305-
internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
306+
internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool *throwOnError)
306307
{
307308
if (!IsBuiltInComSupported)
308309
{
@@ -316,6 +317,7 @@ public static string GetTypeInfoName(ITypeInfo typeInfo!!)
316317
GetTypeFromCLSID(clsid, server, ObjectHandleOnStack.Create(ref type));
317318
return type;
318319
}
320+
#pragma warning restore IDE0060
319321

320322
[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "MarshalNative_GetTypeFromCLSID", StringMarshalling = StringMarshalling.Utf16)]
321323
private static partial void GetTypeFromCLSID(in Guid clsid, string? server, ObjectHandleOnStack retType);

src/coreclr/nativeaot/Common/src/System/Collections/Concurrent/ConcurrentUnifierWKeyed.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public V GetOrAdd(K key)
161161
return heyIWasHereFirst;
162162
if (!_container.HasCapacity)
163163
_container.Resize(); // This overwrites the _container field.
164-
_container.Add(key, hashCode, value);
164+
_container.Add(hashCode, value);
165165
return value;
166166
}
167167
}
@@ -218,7 +218,7 @@ public bool TryGetValue(K key, int hashCode, out V value)
218218
return false;
219219
}
220220

221-
public void Add(K key, int hashCode, V value)
221+
public void Add(int hashCode, V value)
222222
{
223223
Debug.Assert(_owner._lock.IsAcquired);
224224

src/coreclr/nativeaot/Runtime.Base/src/System/AttributeUsageAttribute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace System
1616
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
1717
internal sealed class AttributeUsageAttribute : Attribute
1818
{
19+
#pragma warning disable IDE0060
1920
//Constructors
2021
public AttributeUsageAttribute(AttributeTargets validOn)
2122
{
@@ -24,6 +25,7 @@ public AttributeUsageAttribute(AttributeTargets validOn)
2425
public AttributeUsageAttribute(AttributeTargets validOn, bool allowMultiple, bool inherited)
2526
{
2627
}
28+
#pragma warning restore IDE0060
2729

2830
//Properties.
2931
// Allowing the set properties as it allows a more readable syntax in the specifiers (and are commonly used)

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private struct EHEnum
7676

7777
// This is a fail-fast function used by the runtime as a last resort that will terminate the process with
7878
// as little effort as possible. No guarantee is made about the semantics of this fail-fast.
79-
internal static void FallbackFailFast(RhFailFastReason reason, object unhandledException)
79+
internal static void FallbackFailFast(RhFailFastReason _ /*reason*/, object _1 /*unhandledException*/)
8080
{
8181
InternalCalls.RhpFallbackFailFast();
8282
}
@@ -923,6 +923,7 @@ private static void InvokeSecondPass(ref ExInfo exInfo, uint idxStart, uint idxL
923923
}
924924
}
925925

926+
#pragma warning disable IDE0060
926927
[UnmanagedCallersOnly(EntryPoint = "RhpFailFastForPInvokeExceptionPreemp", CallConvs = new Type[] { typeof(CallConvCdecl) })]
927928
public static void RhpFailFastForPInvokeExceptionPreemp(IntPtr PInvokeCallsiteReturnAddr, void* pExceptionRecord, void* pContextRecord)
928929
{
@@ -933,5 +934,7 @@ public static void RhpFailFastForPInvokeExceptionCoop(IntPtr classlibBreadcrumb,
933934
{
934935
FailFastViaClasslib(RhFailFastReason.PN_UnhandledExceptionFromPInvoke, null, classlibBreadcrumb);
935936
}
937+
#pragma warning restore IDE0060
938+
936939
} // static class EH
937940
}

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Delegate.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private void InitializeClosedStaticThunk(object firstParameter, IntPtr functionP
231231
}
232232

233233
// This function is known to the compiler backend.
234-
private void InitializeOpenStaticThunk(object firstParameter, IntPtr functionPointer, IntPtr functionPointerThunk)
234+
private void InitializeOpenStaticThunk(object _ /*firstParameter*/, IntPtr functionPointer, IntPtr functionPointerThunk)
235235
{
236236
// This sort of delegate is invoked by calling the thunk function pointer with the arguments to the delegate + a reference to the delegate object itself.
237237
m_firstParameter = this;
@@ -483,10 +483,12 @@ private string GetTargetMethodsDescriptionForDebugger()
483483
}
484484
}
485485

486+
#pragma warning disable IDE0060
486487
private static string DebuggerFunctionPointerFormattingHook(IntPtr functionPointer, RuntimeTypeHandle typeOfFirstParameterIfInstanceDelegate)
487488
{
488489
// This method will be hooked by the debugger and the debugger will cause it to return a description for the function pointer
489490
throw new NotSupportedException();
490491
}
492+
#pragma warning restore IDE0060
491493
}
492494
}

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Enum.CoreRT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace System
1616
{
1717
public abstract partial class Enum : ValueType, IComparable, IFormattable, IConvertible
1818
{
19-
internal static EnumInfo GetEnumInfo(Type enumType, bool getNames = true)
19+
internal static EnumInfo GetEnumInfo(Type enumType, bool _ /*getNames*/ = true)
2020
{
2121
Debug.Assert(enumType != null);
2222
Debug.Assert(enumType is RuntimeType);

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.CoreRT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static void FailFast(string message) =>
4343
public static void FailFast(string message, Exception exception) =>
4444
RuntimeExceptionHelpers.FailFast(message, exception);
4545

46-
internal static void FailFast(string message, Exception exception, string errorSource)
46+
internal static void FailFast(string message, Exception exception, string _ /*errorSource*/)
4747
{
4848
// TODO: errorSource originates from CoreCLR (See: https://github.com/dotnet/coreclr/pull/15895)
4949
// For now, we ignore errorSource on CoreRT but we should distinguish the way FailFast prints exception message using errorSource

src/coreclr/nativeaot/System.Private.CoreLib/src/System/IO/FileLoadException.CoreRT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace System.IO
55
{
66
public partial class FileLoadException
77
{
8-
internal static string FormatFileLoadExceptionMessage(string? fileName, int hResult)
8+
internal static string FormatFileLoadExceptionMessage(string? fileName, int _ /*hResult*/)
99
{
1010
return fileName == null ? SR.IO_FileLoad : SR.Format(SR.IO_FileLoad_FileName, fileName);
1111
}

src/coreclr/nativeaot/System.Private.CoreLib/src/System/InvokeUtils.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private static Exception CreateChangeTypeException(EETypePtr srcEEType, EETypePt
273273
case CheckArgumentSemantics.SetFieldDirect:
274274
return CreateChangeTypeArgumentException(srcEEType, dstEEType);
275275
case CheckArgumentSemantics.ArraySet:
276-
return CreateChangeTypeInvalidCastException(srcEEType, dstEEType);
276+
return CreateChangeTypeInvalidCastException();
277277
default:
278278
Debug.Fail("Unexpected CheckArgumentSemantics value: " + semantics);
279279
throw new InvalidOperationException();
@@ -285,7 +285,7 @@ private static ArgumentException CreateChangeTypeArgumentException(EETypePtr src
285285
return new ArgumentException(SR.Format(SR.Arg_ObjObjEx, Type.GetTypeFromHandle(new RuntimeTypeHandle(srcEEType)), Type.GetTypeFromHandle(new RuntimeTypeHandle(dstEEType))));
286286
}
287287

288-
private static InvalidCastException CreateChangeTypeInvalidCastException(EETypePtr srcEEType, EETypePtr dstEEType)
288+
private static InvalidCastException CreateChangeTypeInvalidCastException()
289289
{
290290
return new InvalidCastException(SR.InvalidCast_StoreArrayElement);
291291
}
@@ -548,7 +548,7 @@ internal static object DynamicInvokeBoxedValuetypeReturn(out DynamicInvokeParamL
548548
return finalObjectToReturn;
549549
}
550550

551-
internal static object DynamicInvokeUnmanagedPointerReturn(out DynamicInvokeParamLookupType paramLookupType, object? boxedPointerType, int index, RuntimeTypeHandle type, DynamicInvokeParamType paramType)
551+
internal static object DynamicInvokeUnmanagedPointerReturn(out DynamicInvokeParamLookupType paramLookupType, object? boxedPointerType)
552552
{
553553
object finalObjectToReturn = boxedPointerType;
554554

@@ -630,7 +630,7 @@ public static object DynamicInvokeParamHelperCore(ref ArgSetupState argSetupStat
630630
else if (type.ToEETypePtr().IsPointer)
631631
{
632632
incomingParam = InvokeUtils.CheckArgument(incomingParam, type.ToEETypePtr(), InvokeUtils.CheckArgumentSemantics.DynamicInvoke, argSetupState.binderBundle, ref argSetupState);
633-
return DynamicInvokeUnmanagedPointerReturn(out paramLookupType, incomingParam, index, type, paramType);
633+
return DynamicInvokeUnmanagedPointerReturn(out paramLookupType, incomingParam);
634634
}
635635
else
636636
{

0 commit comments

Comments
 (0)