Re: Protobuf-net Serialize problem

2009-04-04 Thread Marc Gravell
I've just been looking more - and ParseFromString should do the job. I /suspect/ the problem is the definition a string... you aren't going to be able to treat raw binary in .NET as a String; you are going to have to treat it as a Stream or a byte[], or you can encode it to base-64 (as above) to

Re: Protobuf-net Serialize problem

2009-04-03 Thread test.f...@nomail.please
Marc, The server is using ProtoBuf 2.0.1. I had to upgrade my .net version to the latest protobuf-net in order to have protogen work with optional fields correctly. It seems that the server only processes bytes up to the 1st NULL char when calling ParseFromString. Will this problem be avoided

Re: Protobuf-net Serialize problem

2009-04-02 Thread Marc Gravell
Hi; I'm the author of protobuf-net, and I hope I can help you find what is going on here... The binary format should be compatible between platforms (that is the point, after all). Are you able to share your OrderProto class with me? Either here, or at marc.grav...@gmail.com. The base-64 should

Re: Protobuf-net Serialize problem

2009-04-02 Thread test.f...@nomail.please
It seems I was wrong in trying to use ASCII or UTF-8 encoding. This works. private string Serialize(OrderProto proto) { using (MemoryStream stream = new MemoryStream()) { Serializer.SerializeOrderProto(stream, proto); using

Re: Protobuf-net Serialize problem

2009-04-02 Thread test.f...@nomail.please
Actually, I was wrong, this code produces an empty string. The following code serializes *something* which fails on the server side on ParseFromString. Any ideas what I have to do to correctly serialize this? private string Serialize(OrderProto proto) { using

Re: Protobuf-net Serialize problem

2009-04-02 Thread Marc Gravell
Quick question - which build are you using? (at client and server)? Based on the field names, the code-generation dates back to November; if the dlls are aged similarly, it is possible that this is an old bug. If possible, can you retry with the current build? I'm just trying the code you

Re: Protobuf-net Serialize problem

2009-04-02 Thread Marc Gravell
You can't use unicode to transport arbitrary binary data - it won't be a valid unicode string. If you have to use strings, then base-64 is the safest option: private string Serialize(OrderProto proto) { using (MemoryStream stream = new MemoryStream()) {

Re: Protobuf-net Serialize problem

2009-04-02 Thread Marc Gravell
(re last post) As with unicode, you can't use ASCII to handle raw binary; either use base-64 (previous post), or send binary. Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to