protobuf-net

Protobuf-net - serializing .NET GUID - how to read this in C++??

Hi All. I have serialized an object using Protobuf-net , in my .NET application, with relative ease. I also get the .proto file that protobuf-net generated, using GetProto() command. In the .NET generated .proto file, my GUID fields get a type of "bcl.guid". Now I wish to compile the .proto file in C++ so I can deserialize the data. ...

protobuf-net: Serializing an empty List

we have some problems with serializing an empty list. here some code in .NET using CF 2.0 //Generating the protobuf-msg ProtoBufMessage msg = new ProtoBufMessage(); msg.list = new List<AnotherProtobufMessage>(); // Serializing and sending throw HTTP-POST MemoryStream stream = new MemoryStream(); Serializer.Serialize(stream, msg); byte[]...

protobuf-net not deserializing 0's

I'm using protobuf-net r278 in C#, and I just noticed that if I have a class with an int field, the field isn't deserialized properly if it's value is set to 0. Namely, when deserialized it gets its default value from the class definition. Example class: [ProtoBuf.ProtoContract] public class Test { [ProtoBuf.ProtoMember(1)] publ...

protobuf-net - problem with deserializing on C++ side :(

Hi all (and Marc :) I am using ProtoBuf-Net in my .NET application to serialize the following : (in .proto format) message ProtoScreenBuffer { optional int32 MediaId = 1; optional bytes Data = 2; optional bool LastBuffer = 3; optional int64 StartTime = 4; optional int64 StopTime = 5; optional int32 Flags = 6; optional int32 BufferSubTy...

Deserializing a type at the current stream position with protobuf-net

I'm serializing several objects into a single stream, but when i try to read them back, i can't seem to get anything but the last object: ProtoBuf.Serializer.Serialize(stream, postA1); ProtoBuf.Serializer.Serialize(stream, postB1); stream.Position = 0; var postA2 = ProtoBuf.Serializer.Deserialize<Post>(stream); var postB2 = ProtoBuf.Ser...

WCF error service error message with shared classes

Source code: http://code.google.com/p/sevenupdate/source/browse/#hg/Source/SevenUpdate.Base SevenUpdate.Base.Sui cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types. Now I tried unchecking reuse reference types and I was able to get my project to compile. but when sending a coll...

How to choose between protobuf-csharp-port and protobuf-net

Hi Folks, I've recently had to look for a C# porting of the Protocole Buffer library originally developped by Google. And guess what, I found two projects owned both by two very well known persons here: protobuf-csharp-port, written by Jon Skeet and protobuf-net, written by Marc Gravell. My question is simple: which one do I have to ch...

protobuf-net - backticks, Dictionaries & .proto files

I'm trying to talk to a C# program that uses protobuf-net from an iphone using http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers Unfortunately the .proto file I've been given (generated from the C# source code) includes an a line that protoc is rejecting: repeated Pair_Guid_List`1 Local = 6; It appears that this is because ...

Does protobuf-net generated binary compatible with Google specs

Actually I want to serialize my data using Google's java implementation and then deserialize using C# implementation? I have chosen portobuf-net as it seems to be more stable (porto# is still v0.9 or I would have gone for it). Before I start working on it I wanted to be sure that I can achieve this (serializing data using java implementa...

protobuf-net: incorrect wire-type exception deserializing Guid properties

I'm having issues deserializing certain Guid properties of ORM-generated entities using protobuf-net. Here's a simplified example of the code (reproduces most elements of the scenario, but doesn't reproduce the behavior; I can't expose our internal entities, so I'm looking for clues to account for the exception). Say I have a class, Ac...

Custom tool error: Command.proto:11:18: "Message2" is not defined.

I am using the latest version of protobuf-net with VS2008 integration. I have created 2 messages (Message1 and Message2), 1 message in 1 proto file. When I try to reference Message2 in Message1 the code generator tool gives me error "Message2" is not defined and won't generate the code file. The package for both messages is same. It look...

Can protobuf-net serialize this combination of interface and generic collection?

I am trying to serialize a ItemTransaction and protobuf-net (r282) is having a problem. ItemTransaction : IEnumerable<KeyValuePair<Type, IItemCollection>></code> and ItemCollection is like this: FooCollection : ItemCollection<Foo> ItemCollection<T> : BindingList<T>, IItemCollection IItemCollection : IList<Item> where T is a derive...

In Protobuf-net how can I pass an array of type object with objects of different types inside, knowing the set of potential types in advance.

I am trying to migrate existing code that uses XmlSerializer to protobuf-net due to the increased performance it offers, however I am having problems with this specific case. I have an object[] that includes parameters that are going to be sent to a remote host (sort of a custom mini rpc facility). I know the set of types from which the...

Protocol buffer deserialization and a dynamically loaded DLL in Compact Framework

I saw a question related to this on the full framework here. Since it seems to have stayed unresolved for quite a while and this is for the compact framework, I though it would be better to create a new question for it. I want to deserialize types for which I am loading assemblies dynamically (with Assembly.LoadFrom) and I am getting a ...

null string deserialized to empty string when using protobuf-net

I am using protobuf-net to serialize and deserialize my messages. My message also contain come strings that can be null. However when I deserialize them on the other side, I get empty strings (""). According to google docs, the default value for string type in empty string. What could be the resolution for this issue? Here is the code ...

Program hangs when calling parseFrom for java implementation of protobuf

I have a message (say its called OuterMessage) message OuterMessage { optional int64 id = 1; optional InnerMessage inner = 2; } and an inner message message InnerMessage { optional string type = 1; optioanl int64 id = 2; } Now when I call parseFrom on OuterMessage like OuterMessage.parseFrom(buffer) the method never...

RESTful .NET and protobuf-net

Is it possible to use protobuf-net in RESTful webservices created using WCF RESTful starter kit or OpenRasta? If it possible, are there any examples or code snippets available? I am creating a .NET Web Service which will be consumed by Java client. ...

Serialization of non-required fields in protobuf-net

I have a working java client that is communicating with Google, through ProtoBuf serialized messages. I am currently trying to translate that client into C#. I have a .proto file where the parameter appId is an optional string. Its default value in the C# representation as generated by the protobuf-net library is an empty string, just a...

Google Protocol Buffers - Fixed size buffer?

Hi All. Using Google Protocol Buffers, can I set a maximum size for all messages I encode? if I know that what I encode is never larger than X bytes, then Google Protobuffs would always produce a buffer of size Y, and if I give it a smaller amount of data, pad it to size Y? ...

How to process a .proto file using protobuf-net

I have stated using the protobuf-net lib to communication between some of the programs I'm maintaining. I have also been able to decode messages from C# to Ruby. My ruby ProtoBuf lib is using a .proto file to generate the ruby code. In the interest of having to make changes in as few places as possible I would like to have protobuf-net u...