email: s.volchkov@gmail.com
protobuf-net seems to serialize fixed-length integer types (fixed32,
fixed64, sfixed32, sfixed64) as varints.
Example:
.proto file:
message Foo
{
required fixed64 bar = 1;
}
c# code attached; the main part:
foo.Foo f = new foo.Foo();
f.bar = 42;
MemoryStream ms = new MemoryStream();
ProtoBuf.Serializer.Serialize(ms, f);
This produced two byte sequence:
08 2A
(first byte denoting varint field with tag 1, and second containing the
payload)
I thought the likely reason was that in the generated c# file, the
corresponding property was marked with "DataFormat =
ProtoBuf.DataFormat.Default" option.
After some changes in csharp.xslt (see attached patch), everything worked fine:
09 2A 00 00 00 00 00 00 00
Observed on the latest release, r258, .net framework 2.0 and 3.5sp1.
Original issue reported on code.google.com by s.volchkov on 1 Jul 2009 at 8:01
Original issue reported on code.google.com by
s.volchkov
on 1 Jul 2009 at 8:01Attachments: