BOOL CheckForPrimitiveType(CorElementType elemType, CQuickArray<WCHAR> *pStrPrimitiveType);
TypeHandle ArraySubTypeLoadWorker(const SString &strUserDefTypeName, Assembly* pAssembly);
TypeHandle GetFieldTypeHandleWorker(MetaSig *pFieldSig);
+#ifdef _DEBUG
BOOL IsFixedBuffer(mdFieldDef field, IMDInternalImport *pInternalImport);
+#endif
//=======================================================================
{
if (IsStructMarshalable(thNestedType))
{
- if (IsFixedBuffer(pfwalk->m_MD, pInternalImport) && !thNestedType.GetMethodTable()->IsBlittable())
- {
- INITFIELDMARSHALER(NFT_ILLEGAL, FieldMarshaler_Illegal, (IDS_EE_BADMARSHAL_NOTMARSHALABLE));
- }
- else
- {
- INITFIELDMARSHALER(NFT_NESTEDVALUECLASS, FieldMarshaler_NestedValueClass, (thNestedType.GetMethodTable()));
- }
+#ifdef _DEBUG
+ INITFIELDMARSHALER(NFT_NESTEDVALUECLASS, FieldMarshaler_NestedValueClass, (thNestedType.GetMethodTable(), IsFixedBuffer(pfwalk->m_MD, pInternalImport)));
+#else
+ INITFIELDMARSHALER(NFT_NESTEDVALUECLASS, FieldMarshaler_NestedValueClass, (thNestedType.GetMethodTable()));
+#endif
}
else
{
return TRUE;
}
+#ifdef _DEBUG
BOOL IsFixedBuffer(mdFieldDef field, IMDInternalImport *pInternalImport)
{
HRESULT hr = pInternalImport->GetCustomAttributeByName(field, g_FixedBufferAttribute, NULL, NULL);
return hr == S_OK ? TRUE : FALSE;
}
+#endif
//=======================================================================
}
else
{
+#ifdef _DEBUG
+ _ASSERTE_MSG(!IsFixedBuffer(), "Cannot correctly marshal fixed buffers of non-blittable types");
+#endif
LayoutUpdateNative((LPVOID*)ppProtectedCLR, startoffset, pMT, (BYTE*)pNative, ppCleanupWorkListOnStack);
}
}
}
else
{
+#ifdef _DEBUG
+ _ASSERTE_MSG(!IsFixedBuffer(), "Cannot correctly marshal fixed buffers of non-blittable types");
+#endif
LayoutUpdateCLR((LPVOID*)ppProtectedCLR,
startoffset,
pMT,
class FieldMarshaler_NestedValueClass : public FieldMarshaler
{
public:
+#ifndef _DEBUG
FieldMarshaler_NestedValueClass(MethodTable *pMT)
+#else
+ FieldMarshaler_NestedValueClass(MethodTable *pMT, BOOL isFixedBuffer)
+#endif
{
WRAPPER_NO_CONTRACT;
m_pNestedMethodTable.SetValueMaybeNull(pMT);
+#ifdef _DEBUG
+ m_isFixedBuffer = isFixedBuffer;
+#endif
}
BOOL IsNestedValueClassMarshalerImpl() const
START_COPY_TO_IMPL(FieldMarshaler_NestedValueClass)
{
pDestFieldMarshaller->m_pNestedMethodTable.SetValueMaybeNull(GetMethodTable());
+#ifdef _DEBUG
+ pDestFieldMarshaller->m_isFixedBuffer = m_isFixedBuffer;
+#endif
}
END_COPY_TO_IMPL(FieldMarshaler_NestedValueClass)
return m_pNestedMethodTable.GetValueMaybeNull();
}
+#ifdef _DEBUG
+ BOOL IsFixedBuffer() const
+ {
+ return m_isFixedBuffer;
+ }
+#endif
+
private:
// MethodTable of nested NStruct.
RelativeFixupPointer<PTR_MethodTable> m_pNestedMethodTable;
+#ifdef _DEBUG
+ BOOL m_isFixedBuffer;
+#endif
};