Hello
It looks like there is an encoding problem for 0 as Int64. Other values as Int64 ok.
[ProtoMember(3)] private readonly Int64 _intValue
is deserialized as Int64.MinValue
Any idea?
I confirm the bug. This class will not serialize properly if _val == 0
[ProtoContract]
class VerySimple
{
[ProtoMember(1)]
private readonly Int64 _val = Int64.MinValue;
public VerySimple(long val)
{
_val = val;
}
public long Val
{
get { return _val; }
}
public VerySimple()
{
}
}
this test fails
[Test]
public void TestProtobufEncodingSimple()
{
//OK
{
MemoryStream stream = new MemoryStream();
Serializer.Serialize(stream, new VerySimple(1));
stream.Seek(0, SeekOrigin.Begin);
VerySimple reloaded = Serializer.Deserialize<VerySimple>(stream);
Assert.AreEqual(reloaded.Val, 1L);
}
//KO
{
MemoryStream stream = new MemoryStream();
Serializer.Serialize(stream, new VerySimple(0));
stream.Seek(0, SeekOrigin.Begin);
VerySimple reloaded = Serializer.Deserialize<VerySimple>(stream);
Assert.AreEqual(reloaded.Val, 0L);
}
}