Is anyone aware of any issues when using ProtoBuf-Net to serialize/deserialize between compact framework and the full .Net framework? I have a class called LogData that I am se
Easy one: you use:
var buffer = ms.GetBuffer();
And then buffer.Length
. That means you are using the oversized, padded buffer. If you do that you need to use ms.Length
, which will tell you the actual length. Alternatively, ms.ToArray()
may be used, but that involves an extra copy.
My advice: keep using GetBuffer(), but only write ms.Length bytes, not buffer.Length bytes.
Once you have removed these extra incorrect zeros, I expect you'll find it works.