Skip to content

Commit 58ab8de

Browse files
authored
Fixes for type descriptor with generics (#3220)
***NO_CI***
1 parent f187be0 commit 58ab8de

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/CLR/Core/CLR_RT_HeapBlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ bool CLR_RT_HeapBlock::TypeDescriptorsMatch(
791791

792792
// If the *actual* object is a closed-generic (even though boxed as CLASS),
793793
// it will have m_handlerGenericType set. Promote it to GENERICINST.
794-
if (actualDataType == DATATYPE_CLASS && actualType.m_handlerGenericType.data != CLR_EmptyToken)
794+
if (actualDataType == DATATYPE_CLASS && NANOCLR_INDEX_IS_VALID(actualType.m_handlerGenericType))
795795
{
796796
actualDataType = DATATYPE_GENERICINST;
797797
}

src/CLR/Core/TypeSystem.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,9 @@ HRESULT CLR_RT_TypeDescriptor::InitializeFromSignatureToken(
22692269
// !T: ask the CLR to map that slot into the *actual* argument
22702270
CLR_RT_TypeDef_Index td;
22712271
NanoCLRDataType dt;
2272-
assm->FindGenericParamAtTypeSpec(caller->genericType->data, elem.GenericParamPosition, td, dt);
2272+
2273+
g_CLR_RT_TypeSystem.m_assemblies[caller->genericType->Assembly() - 1]
2274+
->FindGenericParamAtTypeSpec(caller->genericType->data, elem.GenericParamPosition, td, dt);
22732275
this->InitializeFromTypeDef(td);
22742276
}
22752277
else if (elem.DataType == DATATYPE_MVAR)

0 commit comments

Comments
 (0)