dotnet / dotnet/dotnet-api-docs
Space used in UnmanagedMemoryAccessor.WriteArray is not documented
Open
area-System.Runtime.InteropServices
Pri3
untriaged
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
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.
Contributor guide
Assessment
This issue has not been assessed yet.