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

protobuf: read a message in C++ from C#

I am going to read messages that are stored consecutively in socket in C++ client that are sent from a C# server. I expect that I can read the size of a message like that: google::protobuf::uint32 m; coded_input->ReadVarint32(&m); cout << m <<…
lord.didger
  • 1,357
  • 1
  • 17
  • 31
8
votes
1 answer

Protobuf-net on UWP/.NET Native and iOS

I have a Xamarin.Forms App based on .NET Standard 1.4 that uses protobuf-net to store objects in the database that will be sent to a WCF service at a later time. On Android and UWP "managed" everything works fine but - after searching through…
EaranMaleasi
  • 895
  • 1
  • 13
  • 32
8
votes
1 answer

Reading a Protobuf Message in C#

I have a simple message: package test; message sendName { optional string username = 1; } The awesome VS plugin generates the .cs file: namespace test { [global::System.Serializable global::ProtoBuf.ProtoContract(Name=@"sendName")] …
sonu
  • 164
  • 2
  • 8
8
votes
4 answers

protobuf-net NOT faster than binary serialization?

I wrote a program to serialize a 'Person' class using XMLSerializer, BinaryFormatter and ProtoBuf. I thought protobuf-net should be faster than the other two. Protobuf serialization was faster than XMLSerialization but much slower than the binary…
Ashish Gupta
  • 14,869
  • 20
  • 75
  • 134
8
votes
3 answers

Serializing F# discriminated unions with protobuf

Is there some way to get protobuf to serialize/deserialize F#'s discriminated unions? I'm trying to serialize messages with protobuf. Messages are F# records and discriminated unions. Serialization seems to work fine for records but I cannot get it…
stmax
  • 6,506
  • 4
  • 28
  • 45
8
votes
1 answer

How protobuf-net serialize DateTime?

I'm working on a project consisting on Client/Server. Client is written in Python (will run on linux) and server in C#. I'm communicating through standard sockets and I'm using protobuf-net for protocol definition. However, I'm wondering how would…
Davita
  • 8,928
  • 14
  • 67
  • 119
8
votes
1 answer

Protobuf-net : Nested IEnumerable objects

I am using Protobuf-net to serialize a custom nested list. I understand that native lists cannot be nested directly, which is why I have used a container object for the inner list. However, I would also like to make my container objects IEnumerable…
Tom Makin
  • 3,203
  • 23
  • 23
8
votes
1 answer

Error while using ProtoBuf-Net with flags enum

While using ProtoBuf-Net and serializing an enum property, where the enum is set to [FlagsAttribute], I received the following error message when serializing an enum value composed of multiple flags. The error is: The value (MyEnum.MyValue) has no…
Stécy
  • 11,951
  • 16
  • 64
  • 89
8
votes
1 answer

Protobuf .NET Post Deserialization Handler

Is there a way to handle an event or call back into an object that has just been deserialized by Protobuf without having to explictly make call the method from the deserialized object? For example, say I have the following…
Ryan
  • 139
  • 2
  • 10
8
votes
2 answers

Protobuf-net is incompatible with official google Protobuf for C++ (message encoding)

We had some (lots of) classes in .NET. We used protobuf-net to mark them up, and generate .proto wrappers for C++ code side via google original library. So I have a message (C++ DebugString() on some EventBase class (in .NET EventCharacterMoved …
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
8
votes
1 answer

How to generate .proto files from Protocol Buffers .NET code?

So having our classes with attributes in folder how to generate .proto markup files out from them (to get for example C++ code)?
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
8
votes
2 answers

Any proper way of sending byte data to Unity3D from a C plugin?

Just a question of curiosity here. When you write plugins for Unity on the iOS platform, the plugins have a limited native-to-managed callback functionality (from the plugin and then to Unity). Basically this documentation: iOS plugin Unity…
CodingBeagle
  • 1,888
  • 2
  • 24
  • 52
8
votes
1 answer

Can I re-use object instances to avoid allocations with protobuf-net?

Context: this is based on a question that was asked and then deleted before I could answer it - but I think it is a good question, so I've tidied it, rephrased it, and re-posted it. In a high-throughput scenario using protobuf-net, where lots of…
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
8
votes
3 answers

Asynchronous protobuf serialization

A limitation of the protobuf-net implementation is that it calls the underlying streams synchronously. By not offering an asynchronous API e.g. BeginSerialize/EndSerialize or a TPL equivalent, we are forced to tie up a thread waiting for synchronous…
Matt Howells
  • 40,310
  • 20
  • 83
  • 102
7
votes
2 answers

protobuf-net v2 and Monotouch : How does it mix?

I have been trying to use protobuf-net with MonoTouch but I have no idea how, and despite having heard that it is possible, I haven't been able to find any tutorial or any example that actually work. It was confirmed by Marc Gravell on his blog that…
Louis Boux
  • 1,228
  • 1
  • 12
  • 26