Skip to content

Commit

Permalink
Fix unecessary IDE0060 suppressions
Browse files Browse the repository at this point in the history
Since dotnet/roslyn#66535 `IDE0060` doesn't warn for throw-only methods.
  • Loading branch information
xtqqczze committed Jul 19, 2024
1 parent 767e416 commit fa6b909
Show file tree
Hide file tree
Showing 25 changed files with 6 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System;
using System.Runtime.InteropServices;

#pragma warning disable IDE0060

namespace Internal.Runtime.InteropServices
{
internal static class ComActivator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;
using System.Runtime.Loader;

#pragma warning disable IDE0060

namespace Internal.Runtime.InteropServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public static void InitializeArray(Array array, RuntimeFieldHandle fldHandle)
throw new PlatformNotSupportedException();
}

#pragma warning disable IDE0060
private static unsafe ref byte GetSpanDataFrom(
RuntimeFieldHandle fldHandle,
RuntimeTypeHandle targetTypeHandle,
Expand All @@ -39,7 +38,6 @@ private static unsafe ref byte GetSpanDataFrom(
// https://github.com/dotnet/corert/issues/364
throw new PlatformNotSupportedException();
}
#pragma warning disable IDE0060

[RequiresUnreferencedCode("Trimmer can't guarantee existence of class constructor")]
public static void RunClassConstructor(RuntimeTypeHandle type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,10 @@ public static int GetEndComSlot(Type t)
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}

#pragma warning disable IDE0060
internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
{
throw new NotSupportedException(SR.PlatformNotSupported_ComInterop);
}
#pragma warning restore

[SupportedOSPlatform("windows")]
public static string GetTypeInfoName(ITypeInfo typeInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ namespace System.IO
{
public static partial class Directory
{
#pragma warning disable IDE0060
private static DirectoryInfo CreateDirectoryCore(string path, UnixFileMode unixCreateMode)
=> throw new PlatformNotSupportedException(SR.PlatformNotSupported_UnixFileMode);
#pragma warning restore IDE0060

private static unsafe string CreateTempSubdirectoryCore(string? prefix)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace System.IO
{
public static partial class File
{
#pragma warning disable IDE0060
private static UnixFileMode GetUnixFileModeCore(string path)
=> throw new PlatformNotSupportedException(SR.PlatformNotSupported_UnixFileMode);

Expand All @@ -19,6 +18,5 @@ private static void SetUnixFileModeCore(string path, UnixFileMode mode)

private static void SetUnixFileModeCore(SafeFileHandle fileHandle, UnixFileMode mode)
=> throw new PlatformNotSupportedException(SR.PlatformNotSupported_UnixFileMode);
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public static void CopyFile(string sourceFullPath, string destFullPath, bool ove
return null; // Let SafeFileHandle create the exception for this error.
}

#pragma warning disable IDE0060
public static void Encrypt(string path)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_FileEncryption);
Expand All @@ -72,7 +71,6 @@ 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
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // implementations provided as intrinsics
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ public sealed partial class PosixSignalRegistration
{
private PosixSignalRegistration() { }

#pragma warning disable IDE0060
[DynamicDependency("#ctor")] // Prevent the private ctor and the IDisposable implementation from getting linked away
private static PosixSignalRegistration Register(PosixSignal signal, Action<PosixSignalContext> handler) =>
throw new PlatformNotSupportedException();
#pragma warning restore IDE0060

partial void Unregister();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

#pragma warning disable IDE0060

namespace System.Runtime.Intrinsics.Wasm
{
[CLSCompliant(false)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;

#pragma warning disable IDE0060 // Remove unused parameter

namespace System.Runtime.Intrinsics.Wasm
{
internal abstract class WasmBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

Expand All @@ -17,8 +16,6 @@ internal X86Base() { }

public static bool IsSupported { [Intrinsic] get => false; }

#pragma warning disable IDE0060

public abstract class X64
{
internal X64() { }
Expand Down Expand Up @@ -119,8 +116,5 @@ internal X64() { }
/// PAUSE
/// </summary>
public static void Pause() { throw new PlatformNotSupportedException(); }

#pragma warning restore IDE0060

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ 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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ 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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,10 @@ public static bool BindHandle(IntPtr osHandle)
throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // Replaced by ThreadPoolBoundHandle.BindHandle
}

#pragma warning disable IDE0060 // Remove unused parameter
[SupportedOSPlatform("windows")]
public static bool BindHandle(SafeHandle osHandle)
{
throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // Replaced by ThreadPoolBoundHandle.BindHandle
}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace System.Runtime.InteropServices.ObjectiveC
{
public static partial class ObjectiveCMarshal
{
#pragma warning disable IDE0060 // Remove when implemented
/// <summary>
/// Sets a pending exception to be thrown the next time the runtime is entered from an Objective-C msgSend P/Invoke.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using System.Runtime.Versioning;
using Microsoft.Win32.SafeHandles;

#pragma warning disable IDE0060

namespace System.Threading
{
#if FEATURE_WASM_MANAGED_THREADS
Expand Down Expand Up @@ -99,10 +97,12 @@ internal static void NotifyThreadUnblocked()

internal static object? GetOrCreateThreadLocalCompletionCountObject() => null;

#pragma warning disable IDE0060
internal static bool NotifyWorkItemComplete(object? threadLocalCompletionCountObject, int currentTimeMs)
{
return true;
}
#pragma warning restore IDE0060

private static RegisteredWaitHandle RegisterWaitForSingleObject(
WaitHandle? waitObject,
Expand Down Expand Up @@ -166,10 +166,12 @@ public static bool BindHandle(SafeHandle osHandle)
throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // Replaced by ThreadPoolBoundHandle.BindHandle
}

#pragma warning disable IDE0060
[Conditional("unnecessary")]
internal static void ReportThreadStatus(bool isWorking)
{

}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.Win32.SafeHandles;

#pragma warning disable IDE0060

namespace System.Threading
{
#if FEATURE_WASM_MANAGED_THREADS
Expand Down Expand Up @@ -134,10 +132,12 @@ public static bool BindHandle(SafeHandle osHandle)
throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // Replaced by ThreadPoolBoundHandle.BindHandle
}

#pragma warning disable IDE0060
[Conditional("unnecessary")]
internal static void ReportThreadStatus(bool isWorking)
{

}
#pragma warning restore IDE0060
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ namespace System.Threading
{
public sealed partial class ThreadPoolBoundHandle : IDisposable
{
#pragma warning disable IDE0060
private static ThreadPoolBoundHandle BindHandleCore(SafeHandle handle)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_OverlappedIO);
}
#pragma warning restore IDE0060
}
}

0 comments on commit fa6b909

Please sign in to comment.