Skip to content

Commit d776d5e

Browse files
authored
Fix MethodBase::Invoke to handle generic instances (#3161)
***NO_CI***
1 parent 0fddf10 commit d776d5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/CLR/CorLib/corlib_native_System_Reflection_MethodBase.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ HRESULT Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJ
135135
{
136136
if (mdR->retValDataType != DATATYPE_VOID)
137137
{
138-
if (mdR->retValDataType < DATATYPE_I4)
138+
// Types that need ChangeDataType: primitives and generic instances
139+
bool needsTypeChange = (mdR->retValDataType < DATATYPE_I4 || mdR->retValDataType == DATATYPE_GENERICINST);
140+
141+
if (needsTypeChange)
139142
{
140143
stack.TopValue().ChangeDataType(mdR->retValDataType);
141144
}

0 commit comments

Comments
 (0)