I have a struct which has a non-overlapping field reported as overlapped.
[FieldOffset(8)]
Int32 X;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
[FieldOffset(12)]
string Y;
[FieldOffset(28)]
int Z;
The reported error is:
Could not load type 'XXX' ... it contains an object field at offset 12 that is incorrectly aligned or overlapped by a non-object field.
It occurs only in Release configuration (TRACE, DEBUG flags and unsafe code are enabled, optimization is turned off), guessing - what happens to it?
UPD: thanks to @svick. Confirmed that x64 build is not what one wants for marshalling.