Skip to content

Commit

Permalink
Fix compiling with Test.CoreLib (dotnet#1481)
Browse files Browse the repository at this point in the history
* We have new exports that are needed.
* Unshare IDynamicInterfaceCastableSupport. I thought it would be shareable, but it uses SR and throws various exceptions. Maybe not so shareable after all.
  • Loading branch information
MichalStrehovsky authored Sep 1, 2021
1 parent 1403cf0 commit 1a17135
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<Compile Include="Internal\IntrinsicSupport\EqualityComparerHelpers.cs" />
<Compile Include="Internal\Reflection\Augments\ReflectionAugments.cs" />
<Compile Include="Internal\Runtime\CompilerServices\Unsafe.cs" />
<Compile Include="Internal\Runtime\IDynamicInterfaceCastableSupport.cs" />
<Compile Include="Internal\Runtime\MethodTable.Runtime.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\ThrowHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\MathHelpers.cs" />
Expand Down Expand Up @@ -370,9 +371,6 @@
<Compile Include="$(CompilerCommonPath)\Internal\Runtime\CanonTypeKind.cs">
<Link>Internal\Runtime\CanonTypeKind.cs</Link>
</Compile>
<Compile Include="$(AotCommonPath)\Internal\Runtime\IDynamicInterfaceCastableSupport.cs">
<Link>Internal\Runtime\IDynamicInterfaceCastableSupport.cs</Link>
</Compile>
<Compile Include="$(AotCommonPath)\Internal\Runtime\MethodTable.cs">
<Link>Internal\Runtime\MethodTable.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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;

namespace Internal.Runtime
{
static unsafe class IDynamicCastableSupport
{
[RuntimeExport("IDynamicCastableIsInterfaceImplemented")]
internal static bool IDynamicCastableIsInterfaceImplemented(object instance, MethodTable* interfaceType, bool throwIfNotImplemented)
{
return false;
}

[RuntimeExport("IDynamicCastableGetInterfaceImplementation")]
internal static IntPtr IDynamicCastableGetInterfaceImplementation(object instance, MethodTable* interfaceType, ushort slot)
{
RuntimeImports.RhpFallbackFailFast();
return default;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,10 @@ private static void AppendExceptionStackFrame(object exceptionObj, IntPtr IP, in
internal static void OnFirstChanceException(object e)
{
}

[RuntimeExport("OnUnhandledException")]
internal static void OnUnhandledException(object e)
{
}
}
}
1 change: 1 addition & 0 deletions src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
<Compile Include="..\..\Runtime.Base\src\Internal\Runtime\CompilerServices\Unsafe.cs">
<Link>Internal\Runtime\CompilerServices\Unsafe.cs</Link>
</Compile>
<Compile Include="Internal\Runtime\IDynamicInterfaceCastableSupport.cs" />
<Compile Include="System\Runtime\CompilerServices\ClassConstructorRunner.cs" />
<Compile Include="System\Runtime\CompilerServices\StaticClassConstructionContext.cs" />
<Compile Include="System\Runtime\InteropServices\InAttribute.cs" />
Expand Down

0 comments on commit 1a17135

Please sign in to comment.