to; it was some unfortunate moment - basically, he checked whether it should be cleared whenever the buffer is full, and, as a result, being in the middle of writing an element with a prefix of length, he could not take a picture correctly at this point, I added a setting so that whenever it detects that it reaches an erasable state, and there is something worth washing up (currently 1024 bytes), then it will be activated more aggressively. It was made as r597. With this patch, it now works as expected.
At the same time, there is a way to avoid this failure without changing the version: iterating over the data in the source, serializing each individually using SerializeWithLengthPrefix with the base of the 128 prefix and the field number 1; this is 100% identical in terms of what goes through the wire, but has a separate serialization cycle for each:
using (var f = File.Create("Data.protobuf")) { foreach(var obj in GenerateData(1000000)) { Serializer.SerializeWithLengthPrefix<DTO>( f, obj, PrefixStyle.Base128, Serializer.ListItemTag); } }
Thank you for noticing; p
source share