bool ILNativeArrayMarshaler::UsePinnedArraySpecialCase()
{
- if (IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags) && (NULL == OleVariant::GetMarshalerForVarType(m_pargs->na.m_vt, TRUE)))
+ if (IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags) && (NULL != m_pargs->na.m_pArrayMT) && (NULL == OleVariant::GetMarshalerForVarType(m_pargs->na.m_vt, TRUE)))
{
return true;
}
pslILEmit->EmitCALL(METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CREATE_MARSHALER, 3, 0);
}
-
void ILNativeArrayMarshaler::EmitMarshalArgumentCLRToNative()
{
CONTRACTL
m_pcsMarshal->EmitCONV_I();
// Optimize marshalling by emitting the data ptr offset directly into the IL stream
// instead of doing an FCall to recalulate it each time when possible.
- m_pcsMarshal->EmitLDC(ArrayBase::GetDataPtrOffset(m_pargs->m_pMarshalInfo->GetArrayElementTypeHandle().MakeSZArray().GetMethodTable()));
+ m_pcsMarshal->EmitLDC(ArrayBase::GetDataPtrOffset(m_pargs->na.m_pArrayMT));
m_pcsMarshal->EmitADD();
EmitStoreNativeValue(m_pcsMarshal);
}
}
+ m_args.na.m_pArrayMT = arrayTypeHnd.GetMethodTable();
+
// Handle retrieving the information for the array type.
IfFailGoto(HandleArrayElemType(&ParamInfo, thElement, asArray->GetRank(), mtype == ELEMENT_TYPE_SZARRAY, isParam, pAssembly), lFail);
break;