{"action":"opened","issue":{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/320","labels_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/320/comments","events_url":"https://api.github.com/repos/michaeledgar/protobuf-net/issues/320/events","html_url":"https://github.com/michaeledgar/protobuf-net/issues/320","id":58234159,"number":320,"title":"Unknown wire type error from multiple writes","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/michaeledgar/protobuf-net/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-19T16:45:42Z","updated_at":"2015-02-19T16:45:42Z","closed_at":null,"body":"```\nMark,\n\nI found that writing multiple items to the same stream causes an \"unknown \nwire-type\" error.\n\nhttp://stackoverflow.com/questions/2152978/using-protobuf-net-i-suddenly-got-an-\nexception-about-an-unknown-wire-type/12403068#12403068\n\nHere is the sample that will demonstrate the problem\n\n    [ProtoContract]\n    public class Data1\n    {\n        [ProtoMember(1, IsRequired=true)]\n        public int A { get; set; }\n    }\n\n    [ProtoContract]\n    public class Data2\n    {\n        [ProtoMember(1, IsRequired = true)]\n        public string B { get; set; }\n    }\n\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            var d1 = new Data1 { A = 1};\n            var d2 = new Data2 { B = \"Hello\" };\n            var ms = new MemoryStream();\n            Serializer.Serialize(ms, d1); \n            Serializer.Serialize(ms, d2);\n            ms.Position = 0;\n            var d3 = Serializer.Deserialize<Data1>(ms); // This will fail\n            var d4 = Serializer.Deserialize<Data2>(ms);\n            Console.WriteLine(\"{0} {1}\", d3, d4);\n        }\n    }\n\nI was using protobuf-net 2.0.0.480 on Windows 7 64 bit.\n\nchriseyre2000@gmail.com\n```\n\n-----\nOriginal issue reported on code.google.com by `chriseyr...@gmail.com` on 16 Sep 2012 at 9:02"}}