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
6
votes
1 answer

How to serialize a large collection

I'm working a system that has lists and dictionaries with over five million items where each item is typically a flat dto with up to 90 primitive properties. The collections are persisted to disk using protobuf-net for resilience and subsequence…
Joe
  • 333
  • 3
  • 10
6
votes
1 answer

How to serialize a closed immutable type with protobuf-net?

For example, I would like to serialize and deserialize System.Drawing.Font which is immutable and cannot be altered to suit protobuf-net conventions. In general, is it possible to write some sort of "custom" serializer in protobuf-net? Edit: Based…
Qwertie
  • 16,354
  • 20
  • 105
  • 148
6
votes
1 answer

Enabling EnumPassthru by default

Quick question, is it possible to enable to EnumPassthru by default on all enum types? At the moment I have to enable this on each enum type manually or use the following method to apply it automatically to my DTO assembly types: public static…
Barguast
  • 5,926
  • 9
  • 43
  • 73
6
votes
1 answer

Invalid binary character when transmitting ProtoBuf-net messages over AWS SQS

I'm using Protobuf-net (https://code.google.com/p/protobuf-net/) to serialize my class, and then trying to transmit this via amazon SQS. When I do that I get this error: Amazon.SQS.AmazonSQSException: Invalid binary character '#xC' was found in the…
mcmillab
  • 2,752
  • 2
  • 23
  • 37
6
votes
2 answers

Preserving proto comments when generating C# with protobuf-net

We are using protobuf-net to handle our Protocol Buffer needs in a C# application. Since we share our .proto files with other, non-managed applications, we are generating our code from the .proto files (not using the code-first protobuf-net…
6
votes
2 answers

Serializing List using a surrogate with protobuf-net exception

I'm using protobuf-net (version 2.0.0.621) and having a problem serializing List type where T is my own class (it does't matter what it contains) and a surrogate is set for T. The surrogate is set like…
6
votes
1 answer

can I set a global object factory for Protobuf-net?

I see the SetFactory method on Protobuf-net. However, it appears to be available on per type basis. (And MethodInfo or a string? Can I hear it for Func?) What I want is the ability to use my IoC container's object resolution and construction…
Brannon
  • 5,324
  • 4
  • 35
  • 83
6
votes
2 answers

Best practice for protobuf-net, versioning and surrogate types

I'm trying to determine how to address this use case using protobuf-net (Marc Gravell's implementation). We have class A, which is considered version 1 An instance of class A has been serialized to disk We now have class B, which is considered…
jro
  • 7,372
  • 2
  • 23
  • 36
6
votes
1 answer

Why is ProtoBuf so slow on the 1st call but very fast inside loops?

Inspired from this question. I created a small benchmark program to compare ProtoBuf, BinaryFormatter and Json.NET. The benchmark itself is a small console based one at https://github.com/sidshetye/SerializersCompare .Feel free to add/improve, it's…
DeepSpace101
  • 13,110
  • 9
  • 77
  • 127
6
votes
2 answers

No serializer defined for System.Version in protobuf-net

After updating to the latest protobuf-net (2.0.0.601) I now get an exception when trying to serialize a value of type System.Version. [ProtoContract(SkipConstructor=true)] public class ServerLoginInfo { [ProtoMember(1)] public Version…
andy.e
  • 170
  • 10
6
votes
2 answers

Dump protocol-buffers data/response

Is it possible to dump(view) data written in PB format without any knowledge about types used to write that data? I've found https://stackoverflow.com/a/10253515/883738 that Briefly, on the wire, protobufs are encoded as 3-tuples of , where the…
Alex Sorokoletov
  • 3,102
  • 2
  • 30
  • 52
6
votes
1 answer

Protobuf.net: how to handle inheritance without [ProtoInclude]

I am using Protobuf.net to serialize some classes. I would like to be able to serialize the SuperHero class (below) without having to specify [ProtoInclude] on the base class. This is because the derived classes are automatically generated but the…
Janik Zikovsky
  • 3,086
  • 7
  • 26
  • 34
6
votes
1 answer

What is the .proto message for datetime in protobuf-net

I am trying to write some code that will generate accurate .proto files from the protobuf-net (V2) runtime type model, so I can write a python client capable of deserializing protobuf-net generated messages. I am a little bit stuck on what the…
Franchesca
  • 1,453
  • 17
  • 32
5
votes
1 answer

Why won't my List serialize with protobuf-net?

[DataContract] public class Foo { [DataMember(Order = 1)] public int FooId { get; set; } } [DataContract] public class Bar : Foo { [DataMember(Order = 2)] public string Name { get; set; } } [DataContract] public class Baz : Bar { …
AgileJon
  • 53,070
  • 5
  • 41
  • 38
5
votes
2 answers

ProtoBuf-Net ProtoInclude Generic Type Subclass

I'm having some problems with ProtoBuf-Net with a subclass of an object which inherits from a generic class. My inheritance tree looks like this: Node SomeNodeType SomeOtherType ResourceNode ShipResource : ResourceNode
Simon Moles
  • 359
  • 1
  • 5
  • 11