-
Couldn't load subscription status.
- Fork 5.2k
Closed
Labels
area-NativeAOT-coreclrin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedregression-from-last-release
Description
This should print true/true and it does so with CoreCLR or Native AOT in .NET 7. Starting with native AOT .NET 8, it prints true/false because CastCache cached the wrong answer. Likely regressed in #90234. Cc @VSadov
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
object o = new Shapeshifter();
Console.WriteLine(Is(o));
Console.WriteLine(Cast(o) != null);
[MethodImpl(MethodImplOptions.NoInlining)]
static bool Is(object o) => o is IEnumerable<object>;
[MethodImpl(MethodImplOptions.NoInlining)]
static IEnumerable<object> Cast(object o) => o as IEnumerable<object>;
class Shapeshifter : IDynamicInterfaceCastable
{
public RuntimeTypeHandle GetInterfaceImplementation(RuntimeTypeHandle interfaceType) => throw new NotImplementedException();
public bool IsInterfaceImplemented(RuntimeTypeHandle interfaceType, bool throwIfNotImplemented) => true;
}Metadata
Metadata
Assignees
Labels
area-NativeAOT-coreclrin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedregression-from-last-release
Type
Projects
Status
No status