Mark,
I found that writing multiple items to the same stream causes an "unknown
wire-type" error.
http://stackoverflow.com/questions/2152978/using-protobuf-net-i-suddenly-got-an-
exception-about-an-unknown-wire-type/12403068#12403068
Here is the sample that will demonstrate the problem
[ProtoContract]
public class Data1
{
[ProtoMember(1, IsRequired=true)]
public int A { get; set; }
}
[ProtoContract]
public class Data2
{
[ProtoMember(1, IsRequired = true)]
public string B { get; set; }
}
class Program
{
static void Main(string[] args)
{
var d1 = new Data1 { A = 1};
var d2 = new Data2 { B = "Hello" };
var ms = new MemoryStream();
Serializer.Serialize(ms, d1);
Serializer.Serialize(ms, d2);
ms.Position = 0;
var d3 = Serializer.Deserialize<Data1>(ms); // This will fail
var d4 = Serializer.Deserialize<Data2>(ms);
Console.WriteLine("{0} {1}", d3, d4);
}
}
I was using protobuf-net 2.0.0.480 on Windows 7 64 bit.
chriseyre2000@gmail.com
Original issue reported on code.google.com by chriseyr...@gmail.com on 16 Sep 2012 at 9:02
Original issue reported on code.google.com by
chriseyr...@gmail.com
on 16 Sep 2012 at 9:02