Questions tagged [protobuf-net]

An independent implementation of Google's protobuf binary serialization format, protobuf-net approaches the problem-space with common .NET coding styles, but retaining the high performance, dense output and cross-platform interoperability.

An independent implementation of Google's protobuf binary serialization format, protobuf-net approaches the problem-space with common .NET coding styles, but retaining the high performance, dense output and cross-platform interoperability. It's compatible with most of the .NET family, including .NET 2.0/3.0/3.5, .NET CF 2.0/3.5, Mono 2.x, Silverlight 2, etc.

In particular (compared to most implementations), it allows:

  • both code-first and contract-first development
  • mutable objects
  • inheritance

Oh, and it is pretty darned fast too.

Resources

1771 questions
7
votes
2 answers

How to deal with null values when serializing arrays with protobuf-net?

The following statement fails with NullReferenceException: TypeModel.Create().DeepClone(new string[1]); Examining the source code reveals that the exception is thrown on purpose, implying that null values in an array violate the protocol buffers…
mark
  • 59,016
  • 79
  • 296
  • 580
7
votes
1 answer

Use Protobuf-net to stream large data files as IEnumerable

I'm trying to use Protobuf-net to save and load data to disk but got stuck. I have a portfolio of assets that I need to process, and I want to be able to do that as fast as possible. I can already read from a CSV but it would be faster to use a…
gjvdkamp
  • 9,929
  • 3
  • 38
  • 46
7
votes
1 answer

Endpoint behavior configuration WCF with Protobuf-net

I have a WCF service (.NET 4) that exposes 4 endpoints of which one endpoint is configured with protobuf-net (V1.0.0.280) behavior extension. However, I noticed that protobuf-net behavior kicks in for ALL defined endpoints including the ones…
Japps
  • 71
  • 1
  • 2
7
votes
2 answers

Human-readable representations in protobuf-net

Does protobuf-net have any APIs to dump a protobuf into human readable form? I was hoping for something like TextFormat.
pepsi
  • 6,785
  • 6
  • 42
  • 74
7
votes
2 answers

Google Protocol Buffers Serialization hangs writing 1GB+ data

I am serializing a large data set using protocol buffer serialization. When my data set contains 400000 custom objects of combined size around 1 GB, serialization returns in 3~4 seconds. But when my data set contains 450000 objects of combined size…
muddxr
  • 71
  • 4
7
votes
1 answer

How RuntimeTypeModel can be used to associate ProtoInclude with a type in protobuf-net?

As I understood, RuntimeTypeModel allows to associate ProtoInclude with a type, which is useful for cases when the type declaration cannot be changed. But I find it hard to understand how it is actually done. Is there an example? Thanks.
mark
  • 59,016
  • 79
  • 296
  • 580
7
votes
1 answer

Does protocol buffers support serialization of object graphs with shared references?

Please, observe the following simple program (based on the example from the protobuf-net project v1 wiki): using System.Collections.Generic; using System.Diagnostics; using System.IO; using ProtoBuf; namespace HelloProtoBuf { [ProtoContract] …
mark
  • 59,016
  • 79
  • 296
  • 580
7
votes
1 answer

How to avoid having duplicate objects in WCF over protobuf

I've a small units tests to test circular dependencies. My object is the following: [ProtoContract] public class Node { [ProtoMember(1)] public String Name { get; set; } [ProtoMember(2,AsReference = true)] public List Childs {…
J4N
  • 19,480
  • 39
  • 187
  • 340
7
votes
1 answer

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?
Steve
  • 1,605
  • 1
  • 18
  • 29
7
votes
4 answers

Protobuf-net enum backwards compatibility

I was trying to add a new enum value for a certain protobuf-serialized class in a new app version, and while testing, noticed that the previous version will throw an exception, given this new file format: An unhandled exception of type…
vgru
  • 49,838
  • 16
  • 120
  • 201
7
votes
0 answers

Can Swagger support Protobuf or WebSockets?

I want my Swagger output to have support for Protobuf and Websockets. (Protobuf is the most important) Based on this issue, I don't think that swagger can support that. My goal is to allow end users to see the value of the Protobuf format since…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
7
votes
1 answer

How to process a .proto file using protobuf-net

I have started 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…
QueueHammer
  • 10,515
  • 12
  • 67
  • 91
7
votes
2 answers

Getting IEnumerable semantics with a NetTcpBinding WCF service?

First, this is not a duplicate of IEnumerable as return type for WCF methods, I think I understand that the WCF architecture only allows concrete types to be transferred that can be stuffed into a message. Second, our setup however is not a…
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
7
votes
0 answers

Serialize object[] with Protobuf-net

I would like to serialize and deserialize some values stored in an object array. public class Sample { public object[] Data; } I know at run-time what types to expect in the array. In effect I want to treat Data inside of Sample as a message…
Meirion Hughes
  • 24,994
  • 12
  • 71
  • 122
7
votes
1 answer

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 =…
Arne Claassen
  • 14,088
  • 5
  • 67
  • 106