Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Dec 28, 2021
1 parent ac474ea commit 93cb169
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo)
}
}

private static bool AppendStackFrameWithoutMethodBase(StringBuilder _) => false;
#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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ internal sealed partial class CalendarData
private bool LoadCalendarDataFromSystemCore(string localeName, CalendarId calendarId) =>
IcuLoadCalendarDataFromSystem(localeName, calendarId);

internal static int GetCalendarsCore(string localeName, bool _, CalendarId[] calendars) =>
#pragma warning disable IDE0060
internal static int GetCalendarsCore(string localeName, bool useUserOverride, CalendarId[] calendars) =>
IcuGetCalendars(localeName, calendars);
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ public static void CopyFile(string sourceFullPath, string destFullPath, bool ove
Interop.CheckIo(Interop.Sys.CopyFile(src, dst, fileLength));
}

public static void Encrypt(string _)
#pragma warning disable IDE0060
public static void Encrypt(string path)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_FileEncryption);
}

public static void Decrypt(string _)
public static void Decrypt(string path)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_FileEncryption);
}
#pragma warning restore IDE0060

private static void LinkOrCopyFile (string sourceFullPath, string destFullPath)
{
Expand Down Expand Up @@ -94,8 +96,8 @@ private static void LinkOrCopyFile (string sourceFullPath, string destFullPath)
}
}


public static void ReplaceFile(string sourceFullPath, string destFullPath, string? destBackupFullPath, bool _1)
#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.
Expand Down Expand Up @@ -160,6 +162,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)
{
Expand Down Expand Up @@ -593,7 +596,9 @@ public static string[] GetLogicalDrives()
return DriveInfoInternal.GetLogicalDrives();
}

internal static string? GetLinkTarget(ReadOnlySpan<char> linkPath, bool _) => Interop.Sys.ReadLink(linkPath);
#pragma warning disable IDE0060
internal static string? GetLinkTarget(ReadOnlySpan<char> linkPath, bool isDirectory) => Interop.Sys.ReadLink(linkPath);
#pragma warning restore IDE0060

internal static void CreateSymbolicLink(string path, string pathToTarget, bool isDirectory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ namespace System.IO.Strategies
// this type defines a set of stateless FileStream/FileStreamStrategy helper methods
internal static partial class FileStreamHelpers
{
private static OSFileStreamStrategy ChooseStrategyCore(SafeFileHandle handle, FileAccess access, bool _) =>
#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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@ public static int GetEndComSlot(Type t)
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}

internal static Type? GetTypeFromCLSID(Guid _, string? _1, bool throwOnError)
#pragma warning disable IDE0060
internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
{
if (throwOnError)
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);

return null;
}
#pragma warning restore IDE0060

[SupportedOSPlatform("windows")]
public static string GetTypeInfoName(ITypeInfo typeInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public static unsafe void FreeBSTR(IntPtr ptr)
}
}

internal static Type? GetTypeFromProgID(string progID, string? _, bool throwOnError)
#pragma warning disable IDE0060
internal static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError)
{
if (progID == null)
throw new ArgumentNullException(nameof(progID));
Expand All @@ -170,6 +171,7 @@ public static unsafe void FreeBSTR(IntPtr ptr)

return null;
}
#pragma warning restore IDE0060

/// <summary>
/// Get the last system error on the current thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,8 @@ public static IntPtr GetHINSTANCE(Module m)
}

#if !CORECLR
private static Exception? GetExceptionForHRInternal(int errorCode, IntPtr _)
#pragma warning disable IDE0060
private static Exception? GetExceptionForHRInternal(int errorCode, IntPtr errorInfo)
{
switch (errorCode)
{
Expand Down Expand Up @@ -904,6 +905,7 @@ public static IntPtr GetHINSTANCE(Module m)
return new COMException("", errorCode);
}
}
#pragma warning restore IDE0060
#endif

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ private void CreateEventCore(bool initialState, EventResetMode mode, string? nam
createdNew = true;
}

private static OpenExistingResult OpenExistingWorker(string _, out EventWaitHandle? _1)
#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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ private void CreateSemaphoreCore(int initialCount, int maximumCount, string? nam
createdNew = true;
}

private static OpenExistingResult OpenExistingWorker(string _, out Semaphore? _1)
#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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ 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() { }

internal static bool CanSetMinIOCompletionThreads(int _) => true;
internal static void SetMinIOCompletionThreads(int _) { }
#pragma warning disable IDE0060
internal static bool CanSetMinIOCompletionThreads(int ioCompletionThreads) => true;
internal static bool CanSetMaxIOCompletionThreads(int ioCompletionThreads) => true;
#pragma warning restore IDE0060

internal static bool CanSetMaxIOCompletionThreads(int _) => true;
internal static void SetMaxIOCompletionThreads(int _) { }
[Conditional("unnecessary")]
internal static void SetMinIOCompletionThreads(int ioCompletionThreads) { }
[Conditional("unnecessary")]
internal static void SetMaxIOCompletionThreads(int ioCompletionThreads) { }

public static bool SetMaxThreads(int workerThreads, int completionPortThreads) =>
PortableThreadPool.ThreadPoolInstance.SetMaxThreads(workerThreads, completionPortThreads);
Expand Down Expand Up @@ -90,8 +94,11 @@ public static void GetAvailableThreads(out int workerThreads, out int completion
/// <summary>
/// Called from the gate thread periodically to perform runtime-specific gate activities
/// </summary>
/// <param name="cpuUtilization">CPU utilization as a percentage since the last call</param>
/// <returns>True if the runtime still needs to perform gate activities, false otherwise</returns>
internal static bool PerformRuntimeSpecificGateActivities(int _) => false;
#pragma warning disable IDE0060
internal static bool PerformRuntimeSpecificGateActivities(int cpuUtilization) => false;
#pragma warning restore IDE0060

internal static void NotifyWorkItemProgress() => PortableThreadPool.ThreadPoolInstance.NotifyWorkItemProgress();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,14 @@ private static void DispatchWorkItemWithWorkerTracking(object workItem, Thread c
bool reportedStatus = false;
try
{
ThreadPool.ReportThreadStatus(true);
ThreadPool.ReportThreadStatus(isWorking: true);
reportedStatus = true;
DispatchWorkItem(workItem, currentThread);
}
finally
{
if (reportedStatus)
ThreadPool.ReportThreadStatus(false);
ThreadPool.ReportThreadStatus(isWorking: false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ internal sealed partial class TimerQueue : IThreadPoolWorkItem
private bool _isScheduled;
private long _scheduledDueTimeMs;

private TimerQueue(int _)
#pragma warning disable IDE0060
private TimerQueue(int id)
{
}
#pragma warning restore IDE0060

private static List<TimerQueue> InitializeScheduledTimerManager_Locked()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 _, string standardDisplayName)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo)
}
}

private static bool AppendStackFrameWithoutMethodBase(StringBuilder _) => false;
#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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ namespace System.IO
{
public partial class FileLoadException
{
internal static string FormatFileLoadExceptionMessage(string? _, int _1)
#pragma warning disable IDE0060
internal static string FormatFileLoadExceptionMessage(string? fileName, int hResult)
{
return "";
}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ namespace System
{
public partial class MissingMemberException
{
internal static string FormatSignature(byte[] _)
#pragma warning disable IDE0060
internal static string FormatSignature(byte[] signature)
{
return "";
}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ 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
private Assembly InternalLoadFromPath(string? assemblyPath, string? _)
#pragma warning disable IDE0060
private Assembly InternalLoadFromPath(string? assemblyPath, string? nativeImagePath)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;

assemblyPath = assemblyPath?.Replace('\\', Path.DirectorySeparatorChar);
// 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,13 @@ internal static bool IsComObject(RuntimeType type, bool isGenericCOM)
return isGenericCOM ? false : IsComObject(type);
}

internal static bool IsContextful(RuntimeType _)
{
return false;
}

internal static bool IsEquivalentTo(RuntimeType _1, RuntimeType _2)
#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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ internal sealed unsafe partial class LowLevelLifoSemaphore : IDisposable
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern IntPtr InitInternal();

private void Create(int _)
#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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]? _) => false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Diagnostics;

namespace System.Threading
{
public static partial class ThreadPool
{
internal static void ReportThreadStatus(bool _)
[Conditional("unnecessary")]
internal static void ReportThreadStatus(bool isWorking)
{
}

Expand Down

0 comments on commit 93cb169

Please sign in to comment.