diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 1050e96b6b..8c016c54e9 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -217,14 +217,6 @@ namespace System.Management.Automation } - // ComObjectType is null on CoreCLR for Linux since there is - // no COM support on Linux - internal static bool HasCom() - { - // TODO: catch exception from Type.IsComObject - return IsWindows; - } - // The Antimalware Scan Interface is not supported on Linux internal static bool HasAmsi() { diff --git a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs index 50592a4e4d..8d598b13bc 100644 --- a/src/System.Management.Automation/engine/runtime/Binding/Binders.cs +++ b/src/System.Management.Automation/engine/runtime/Binding/Binders.cs @@ -677,14 +677,11 @@ namespace System.Management.Automation.Language private static TypeInfo GetComObjectType() { - if (Platform.HasCom()) - { - return typeof(object).GetTypeInfo().Assembly.GetType("System.__ComObject").GetTypeInfo(); - } - else - { - return null; - } +#if LINUX + return null; +#else + return typeof(object).GetTypeInfo().Assembly.GetType("System.__ComObject").GetTypeInfo(); +#endif } internal static bool IsComObject(object obj) diff --git a/src/System.Management.Automation/utils/ExtensionMethods.cs b/src/System.Management.Automation/utils/ExtensionMethods.cs index 0e58cc55f4..1c1c76f199 100644 --- a/src/System.Management.Automation/utils/ExtensionMethods.cs +++ b/src/System.Management.Automation/utils/ExtensionMethods.cs @@ -130,12 +130,9 @@ namespace System.Management.Automation [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static bool IsComObject(this Type type) { - if (!Platform.HasCom()) - { - return false; - } - -#if CORECLR // Type.IsComObject(Type) is not in CoreCLR +#if LINUX + return false; +#elif CORECLR // Type.IsComObject(Type) is not in CoreCLR return ComObjectType.IsAssignableFrom(type); #else return type.IsCOMObject; diff --git a/test/csharp/test_CorePsPlatform.cs b/test/csharp/test_CorePsPlatform.cs index d0132b121d..ce979e818d 100644 --- a/test/csharp/test_CorePsPlatform.cs +++ b/test/csharp/test_CorePsPlatform.cs @@ -15,12 +15,6 @@ namespace PSTests Assert.True(Platform.IsCore); } - [Fact] - public static void TestHasCom() - { - Assert.False(Platform.HasCom()); - } - [Fact] public static void TestHasAmsi() {