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
254
votes
9 answers

Converting Stream to String and back

I want to serialize objects to strings, and back. We use protobuf-net to turn an object into a Stream and back, successfully. However, Stream to string and back... not so successful. After going through StreamToString and StringToStream, the new…
flipuhdelphia
  • 2,543
  • 2
  • 12
  • 5
81
votes
8 answers

Using Protobuf-net, I suddenly got an exception about an unknown wire-type

(this is a re-post of a question that I saw in my RSS, but which was deleted by the OP. I've re-added it because I've seen this question asked several times in different places; wiki for "good form") Suddenly, I receive a ProtoException when…
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
74
votes
5 answers

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

I've recently had to look for a C# porting of the Protocol Buffers 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…
pierroz
  • 7,653
  • 9
  • 48
  • 60
52
votes
2 answers

How does protocol buffer handle versioning?

How does protocol buffers handle type versioning? For example, when I need to change a type definition over time? Like adding and removing fields.
CodingHero
  • 2,865
  • 6
  • 29
  • 42
42
votes
2 answers

How do I generate a .proto file from a C# class decorated with attributes?

Trying to get my mind around google protobuf. I found some implementation of protobuf in C# but they seems to lack one feature: the ability to generate .proto files automatically from an existing C# class decorated with attributes. The reason I want…
Stécy
  • 11,951
  • 16
  • 64
  • 89
37
votes
2 answers

How does protobuf-net achieve respectable performance?

I want to understand why the protocol buffers solution for .NET developed by Marc Gravell is as fast as it is. I can understand how the original Google solution achieved its performance: it pre-generates optimized code for object serialization;…
MichaelT
  • 7,574
  • 8
  • 34
  • 47
34
votes
2 answers

Getting started with protobuf-net

I'm trying to get started with protobuf.net. I've downloaded the latest version from here, implemented a [ProtoContract] class, and now I'm trying to serialize it with ProtoBuf.Serializer.Serialize as described in the documentation. The problem is,…
Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
34
votes
2 answers

How to Serialize Inherited Class with ProtoBuf-Net

I am sorry if this is a duplicate. I have searched several places for an answer that I might understand including: ProtoBuf.net Base class properties is not included when serializing derived class Serialize inherited classes using protobuf-net My…
ScruffyDuck
  • 2,606
  • 3
  • 34
  • 50
32
votes
2 answers

Does protobuf-net have built-in compression for serialization?

I was doing some comparison between BinaryFormatter and protobuf-net serializer and was quite pleased with what I found, but what was strange is that protobuf-net managed to serialize the objects into a smaller byte array than what I would get if I…
theburningmonk
  • 15,701
  • 14
  • 61
  • 104
32
votes
3 answers

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(); // Serializing and sending throw…
bopa
  • 1,105
  • 1
  • 12
  • 20
31
votes
2 answers

Protobuf-net: Attempted to read past the end of the stream

Our system, when serializing one message using protobuf-net, sometimes, but not every time, raises the error exposed below. What are the reasons for the error and how can I mitigate it? Please notice that we are using DeserializeWithLengthPrefix…
Mimere
  • 763
  • 2
  • 10
  • 15
26
votes
4 answers

Can I serialize arbitrary types with protobuf-net?

I'm trying to serialize some objects with protobuf-net, but unfortunately they make liberal use of DateTimeOffset, which is not yet supported by protobuf-net. This leads to lots of: No serializer defined for type: System.DateTimeOffset Can I…
ladenedge
  • 13,197
  • 11
  • 60
  • 117
26
votes
3 answers

Does protobuf-net support nullable types?

Is it possible to generate nullable members in protobuf-net? message ProtoBuf1 { optional Int32? databit = 1; optional Nullable databool = 2; }
user585058
  • 261
  • 1
  • 3
  • 3
26
votes
2 answers

protobuf-net - generated class from .proto - Is repeated field supposed to be Read Only with no setter?

I am totally confused about this. I have looked around and can't seem to find a direct answer. I have a .proto file that my project, which has all been java, uses to create some messages. There is a repeated Info field. Which is a type we created.…
Mimerr
  • 390
  • 1
  • 5
  • 14
24
votes
1 answer

How do you share gRPC proto definitions between services

I am specifying a number of independent gRPC services that will all be hosted out of the same server process. Each service is defined in its own protobuf file. These are then run through the gRPC tools to give me the target language (c# in my case)…
Wizbit
  • 421
  • 1
  • 4
  • 13
1
2 3
99 100