Skip to content

Commit

Permalink
Fix calling a ThisCall delegate via Reverse P/Invoke.
Browse files Browse the repository at this point in the history
The m_paramidx value is always -1 for return values, so we ignore it when emitting in case we are using a byref return value that needs a real arg index (which is 0-based).

Fixes dotnet#33129
  • Loading branch information
jkoritzinsky committed Jul 6, 2020
1 parent 0126799 commit 835d611
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/mlinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,7 @@ void MarshalInfo::GenerateReturnIL(NDirectStubLinker* psl,
// now for backward compatibility.
X86_ONLY(wNativeSize = StackElemSize(wNativeSize));

pMarshaler->EmitMarshalReturnValue(pcsMarshal, pcsUnmarshal, pcsDispatch, m_paramidx + argOffset, wNativeSize, dwMarshalFlags, &m_args);
pMarshaler->EmitMarshalReturnValue(pcsMarshal, pcsUnmarshal, pcsDispatch, argOffset, wNativeSize, dwMarshalFlags, &m_args);

pcsMarshal->EmitNOP("// } return");
pcsUnmarshal->EmitNOP("// } return");
Expand Down

0 comments on commit 835d611

Please sign in to comment.