Description
When the PrimitiveMap object marshals itself it places that data into a MemoryStream as its being marshaled and once finished returns a byte array containing the marshaled form of the Map. When returning the byte array it calls GetBuffer on the MemoryStream which can contain additional unused bytes from the stream buffer. It should instead call ToArray to get a copy of the data written and no more.