diff --git a/src/System.Management.Automation/utils/ClrFacade.cs b/src/System.Management.Automation/utils/ClrFacade.cs
index bfd4797a121..52d97537f51 100644
--- a/src/System.Management.Automation/utils/ClrFacade.cs
+++ b/src/System.Management.Automation/utils/ClrFacade.cs
@@ -63,11 +63,7 @@ static ClrFacade()
/// SafeHandle
internal static SafeHandle GetSafeProcessHandle(Process process)
{
-#if CORECLR
return process.SafeHandle;
-#else
- return new SafeProcessHandle(process.Handle);
-#endif
}
#endregion Process
@@ -79,12 +75,8 @@ internal static SafeHandle GetSafeProcessHandle(Process process)
///
internal static int SizeOf()
{
-#if CORECLR
// Marshal.SizeOf(Type) is obsolete in CoreCLR
return Marshal.SizeOf();
-#else
- return Marshal.SizeOf(typeof(T));
-#endif
}
///
@@ -92,12 +84,8 @@ internal static int SizeOf()
///
internal static void DestroyStructure(IntPtr ptr)
{
-#if CORECLR
// Marshal.DestroyStructure(IntPtr, Type) is obsolete in CoreCLR
Marshal.DestroyStructure(ptr);
-#else
- Marshal.DestroyStructure(ptr, typeof(T));
-#endif
}
///
@@ -105,12 +93,8 @@ internal static void DestroyStructure(IntPtr ptr)
///
internal static T PtrToStructure(IntPtr ptr)
{
-#if CORECLR
// Marshal.PtrToStructure(IntPtr, Type) is obsolete in CoreCLR
return Marshal.PtrToStructure(ptr);
-#else
- return (T)Marshal.PtrToStructure(ptr, typeof(T));
-#endif
}
///
@@ -121,11 +105,7 @@ internal static void StructureToPtr(
IntPtr ptr,
bool deleteOld)
{
-#if CORECLR
Marshal.StructureToPtr(structure, ptr, deleteOld);
-#else
- Marshal.StructureToPtr(structure, ptr, deleteOld);
-#endif
}
#endregion Marshal
@@ -187,13 +167,11 @@ internal static Encoding GetDefaultEncoding()
{
#if UNIX // PowerShell Core on Unix
s_defaultEncoding = new UTF8Encoding(false);
-#elif CORECLR // PowerShell Core on Windows
+#else // PowerShell Core on Windows
EncodingRegisterProvider();
uint currentAnsiCp = NativeMethods.GetACP();
s_defaultEncoding = Encoding.GetEncoding((int)currentAnsiCp);
-#else // Windows PowerShell
- s_defaultEncoding = Encoding.Default;
#endif
}
return s_defaultEncoding;
@@ -210,15 +188,11 @@ internal static Encoding GetOEMEncoding()
{
#if UNIX // PowerShell Core on Unix
s_oemEncoding = GetDefaultEncoding();
-#elif CORECLR // PowerShell Core on Windows
+#else // PowerShell Core on Windows
EncodingRegisterProvider();
uint oemCp = NativeMethods.GetOEMCP();
s_oemEncoding = Encoding.GetEncoding((int)oemCp);
-
-#else // Windows PowerShell
- uint oemCp = NativeMethods.GetOEMCP();
- s_oemEncoding = Encoding.GetEncoding((int)oemCp);
#endif
}
return s_oemEncoding;
@@ -226,7 +200,6 @@ internal static Encoding GetOEMEncoding()
private static volatile Encoding s_oemEncoding;
-#if CORECLR
private static void EncodingRegisterProvider()
{
if (s_defaultEncoding == null && s_oemEncoding == null)
@@ -234,7 +207,6 @@ private static void EncodingRegisterProvider()
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
}
-#endif
#endregion Encoding