Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ComWrappers for NativeAOT on non-Windows #85000

Merged
Merged
3 changes: 1 addition & 2 deletions src/coreclr/nativeaot/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
<DefineConstants Condition="'$(FeatureCominterop)' == 'true'">FEATURE_COMINTEROP;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<FeatureComWrappers>false</FeatureComWrappers>
<FeatureComWrappers Condition="'$(TargetsWindows)' == 'true'">true</FeatureComWrappers>
<FeatureComWrappers>true</FeatureComWrappers>
</PropertyGroup>
<PropertyGroup>
<FeatureObjCMarshal>false</FeatureObjCMarshal>
Expand Down
5 changes: 5 additions & 0 deletions src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace TestLibrary
Expand All @@ -26,5 +27,9 @@ public static class PlatformDetection
public static bool IsMonoLLVMAOT => _variant == "llvmaot";
public static bool IsMonoLLVMFULLAOT => _variant == "llvmfullaot";
public static bool IsMonoInterpreter => _variant == "monointerpreter";

public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;

public static bool IsNativeAot => !IsMonoRuntime && !RuntimeFeature.IsDynamicCodeSupported;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NativeAotIncompatible>false</NativeAotIncompatible>
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NativeAotIncompatible>false</NativeAotIncompatible>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
Expand Down
9 changes: 7 additions & 2 deletions src/tests/Interop/COM/ComWrappers/API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace ComWrappersTests
using System.Runtime.InteropServices;

using ComWrappersTests.Common;
using TestLibrary;
using Xunit;

class Program
Expand Down Expand Up @@ -713,8 +714,12 @@ static int Main()
ValidateBadComWrapperImpl();
ValidateRuntimeTrackerScenario();
ValidateQueryInterfaceAfterManagedObjectCollected();
ValidateAggregationWithComObject();
ValidateAggregationWithReferenceTrackerObject();

if (!PlatformDetection.IsNativeAot)
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
{
ValidateAggregationWithComObject();
ValidateAggregationWithReferenceTrackerObject();
}

// Ensure all objects have been cleaned up.
ForceGC();
Expand Down