mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove Platform.HasCom query
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,12 +15,6 @@ namespace PSTests
|
||||
Assert.True(Platform.IsCore);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestHasCom()
|
||||
{
|
||||
Assert.False(Platform.HasCom());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void TestHasAmsi()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user