protobuf-net

protobuf-net and deriving from generic collections

I am having trouble figuring out how to get protobuf-net to serialize an object that derives from List< T >. I have tried adding the ProtoInclude attribute but I receive an ProtoBuf.ProtoException : Known-type List`1 for ProtoIncludeAttribute must be a direct subclass of UserTypeCollection. When I remove the ProtoInclude attrib it appear...

Add raw serialized value to a repeated field in protocol buffers (protobuf-net, protobuf-csharp)

I am looking for a way to add a serialized value of an object (byte[]) to a repeated field in a protocol buffers message. I have an application that keeps data items in serialized form in memcached and needs to deliver them to remote clients. The client requests data items by providing a list of keys and the server sends back the list o...

protobuf-net Merge collection to existing file

I have serialized a collection to a file using protobuf-net. I am looking for a way to merge a few more items to the existing file. Currently I have this: [Test] public void CanAppend() { var list = new List<Person>(); for (int i = 0; i < 1000; i++) list.Add(new Person {Name = i.ToString(), Age = i}); using (var...

Protobuf, how to add custom version detail in binary

I want to tag each protobuf serialized data with my own version number. so i can check which version was used to serialize data if required. Although protobuf is designed around idea so you don't need to check version. To do that i can use same way we have been doing in .net serialization add version field in it. Just want to confirm t...

For which scenarios is protobuf-net not appropriate?

We have been using BinarySerialization with our C# app, but the size and complexity of the classes which need to be serialized results in sloooooow (de)serialization, and large files. We suspect that we should just write our own custom serializers; but protobuf-net claims significant speed and size advantages over standard .Net binary ...

protobuf-net and interface support

This question directly in large part to the protobuf-net maintainer(s) but anyone else please comment. I was trying to serialize a class that contains a property which has an interface type, ie: [DataContract] public class SampleDataClass { [DataMember(Order=1)] public int Field1 { get; set; } [DataMemb...

protobuf-net not deserializing array of sbyte

I have a class defined in C++/CLI as such: literal Int32 BufferLength = 4000; Message() { num1 = 0; num2 = 0; str1 = String::Empty; buffer = gcnew array<System::SByte>(BufferLength); }; [ProtoMember(1)] property double num1 { double get() { return _num1; } void set(double value) { _num1 = value; } } [ProtoMember(2)]...

Protobuf-Net: how to serialize guids?

Is there a preferred method for serializing Guids in protobuf-net? It doesn't seem to be a supported type? ...

Anyone seen this problem with protobuf-net over net.msmq

I am seeing a problem where I send large messages over wcf net.msmq using protobuf-net and get the following error: The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'DeliverData'. End element 'proto' from namespace 'http://mynamespace' expected If mes...

Protobuf-net r282 having problems deserializing object serialized with r249

I've just updated from r249 to r282. Other than replacing the dll I've made no changes. Unfortunately, now deserializing the objects created before the update takes significantly longer. What used to take two seconds now takes five minutes. Were there syntax changes between versions? Is there anything it no longer supports? My classes...

How do I use protobuf-net in Silverlight WCF generated service

I try to use protobuf-net in WCF/Silverlight application to improve large objects array serialization performance. I can serialize/deserialize classes (added Order=, etc) in the service code. But when I try to apply ProtoBehavior, and call the protobuf-enabled service method from Silverlight, I get nulls instead of data (or errors). I ...

Generating FaultContract attributes from .proto rpc entries

I am using protobuf-net on the project I am working on for the data contracts, creating the .proto files by hand and having the custom tool spew forth the C# code which it is duly doing. I have also started using it for service contracts and the service interfaces are also created just fine. For connectivity to some systems I am using W...

Protobuf-net serializing based on interfaces

I am using protobuf-net r282 and when I call Serialize I get the InvalidOperationException error message "Only data-contract classes (and lists/arrays of such) can be processed (error processing Object)". At the point where protobuf-net Serializer.Serialize is being called the object in question has been cast to an interface. Is there a ...

Protobuf-net .proto file generation for inheritance

I am prototyping Protobuf-net to replace some of our existing C# code which is currently using [Datacontract] to Serialize objects to Xml. Using protobuffer we can easily share data with Java. I am thus very interested in the .proto file generation of Protobuf-net. This worked well for almost all the use cases I tested so far. But now ...

Data Member Order is missing from wcf client proxy generated class.

Hello, Have mapped table from sql database to linq in Employee dbml file. [global::System.Runtime.Serialization.DataContractAttribute()] public partial class tbEmployee { private int _Employeeid; private string _EmployeeName; public tbEmployee() { } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage...

Deserializing a List of messages with protobuf-net

I have a java backend that sends messages using protobuf, it sends delimited message objects in one big byte array blob over tib. I can deserialize them fine using the function parseDelimitedFrom(yourStreamHere) in java but on the C# side we are having some issues and I couldn't find any examples but I may just be missing something obvio...

Serialize a class having an interface type member using protobuf-net

I'm unable to serialize my class using protobuf-net, the issue seems to be that protobuf-net is unable to serialize the interface. interface MyInterface { string name; } [ProtoContract] [ProtoInclude(1, typeof(MyClass1))] [ProtoInclude(2, typeof(MyClass2))] public abstract class ParentClass { [ProtoMember(1)] List<MyInterf...

protobuf.net Unexpected subtype

I'm encountering this Exception in my project using Protobuf.net: InvalidOperationException "Unexpected sub-type: foo" I have a class which I'm sending which looks like this: class message { list<bar> listOfBars; } foo inherits off bar, However protobuf seems to choke on this and generate the exception above. Is there some way ...

How does Protobuf-net support for Dictionary/KeyValuePair works?

I am trying to understand protobuf-net's Dictionary/KeyValuePair support. We would like to use the underlying binary stream and the generated proto file from java, but the generated .proto file contains what look like a custom type called Pair_String_Int32. Can someone please shed some light on this? I've got a class mapped like this:...

Any issues with protobuf-net and .Net 4?

Protobuf-net's project page talks about all .Net versions apart from 4. Are there any issues with using protobuf-net under .Net 4? ...