Open
Description
The important bit of this issue is here: https://referencesource.microsoft.com/#mscorlib/system/runtime/interopservices/safebuffer.cs,334
WriteArray
is specified to take an array and write it to an unmanaged buffer. However, the space used for each element of the array is not the standard Marshal.SizeOf
, it's an internal-only Marshal.SizeOfAligned
, which can be significantly different. This means that callers can't know how much space is actually required to write the array without reading the source code themselves.