I'm getting the error below with this struct
Error Message:
"because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field."
Struct:
public struct Buf_t
{
[FieldOffset(0)]
public ushort eventType;
[FieldOffset(4)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1932)]
public byte[] data;
[FieldOffset(1936)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] heap;
}
Similar question has been asked here: Incorrectly aligned or overlapped by a non-object field error. But I'm not seeing DWORD boundary issue on mine. Not sure what I'm missing here.