diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index 8afa2302a10ae1..db27e8856ab793 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -2890,7 +2890,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re break; case CORINFO_VIRTUALCALL_LDVIRTFTN: - if (callInfo.sig.sigInst.methInstCount != 0) + if ((callInfo.sig.sigInst.methInstCount != 0) || (m_compHnd->getClassAttribs(resolvedCallToken.hClass) & CORINFO_FLG_SHAREDINST)) { assert(extraParamArgLocation == INT_MAX); // We should not have a type argument for the ldvirtftn path since we don't know diff --git a/src/tests/JIT/interpreter/Interpreter.cs b/src/tests/JIT/interpreter/Interpreter.cs index 53b6fa817145cb..088e03cfd2949f 100644 --- a/src/tests/JIT/interpreter/Interpreter.cs +++ b/src/tests/JIT/interpreter/Interpreter.cs @@ -1885,7 +1885,7 @@ private static Type LoadType() return typeof(T); } - class GenericClass + class GenericClass : IGeneric { public Type GetTypeOfTInstance() { @@ -1895,6 +1895,11 @@ public static Type GetTypeOfTStatic() { return typeof(T); } + + Type IGeneric.Method() + { + return typeof(T); + } } public static bool TestSharedGenerics_IsInst(object o) @@ -2135,6 +2140,11 @@ public static bool TestSharedGenerics_CallsTo() return true; } + interface IGeneric + { + Type Method(); + } + public static bool TestGenerics_CallsFrom() { if (LoadType() != typeof(T)) @@ -2146,6 +2156,9 @@ public static bool TestGenerics_CallsFrom() if (GenericClass.GetTypeOfTStatic() != typeof(T)) return false; + if (((IGeneric)new GenericClass()).Method() != typeof(T)) + return false; + return true; }