protobuf-net

Parsing a raw Protocol Buffer byte stream in C#

吃可爱长大的小学妹 提交于 2019-12-21 20:26:40
问题 Given a protocol buffer encoded Stream or byte[] but NOT knowing the object type itself, how can we print the skeleton of the message? The use case is for debugging IO that's protobuf based, for root cause analysis. If there are existing tools that can parse the raw Protocol Buffer byte stream from a binary file - that would be great! An alternative could be using the ProtoBuf.NET class ProtoReader() to keep chugging along till we hit the error but the usage of ProtoReader() isn't clear. I

Endpoint behavior configuration WCF with Protobuf-net

杀马特。学长 韩版系。学妹 提交于 2019-12-21 12:02:50
问题 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 protbuf-net is not configured for! I have pasted my config below. Am I missing something? Any help is greatly appreciated .. thx <service name="MyService" behaviorConfiguration="MyServiceBehavior"> <endpoint address="Http.Basic" binding="basicHttpBinding"

“Invalid field in source data: 0” error with ProtoBuf-Net and Compact Framework

谁都会走 提交于 2019-12-21 07:44:50
问题 Is anyone aware of any issues when using ProtoBuf-Net to serialize/deserialize between compact framework and the full .Net framework? I have a class called LogData that I am serializing under compact framework 3.5, transmitting to a server (running .Net framework 4.0), which then deserializes. Sometimes it works and sometimes it throws the above error and I have yet to narrow it down to any specific cause. I've done many many tests with different values and can't seem to find any rhyme or

“Invalid field in source data: 0” error with ProtoBuf-Net and Compact Framework

馋奶兔 提交于 2019-12-21 07:41:13
问题 Is anyone aware of any issues when using ProtoBuf-Net to serialize/deserialize between compact framework and the full .Net framework? I have a class called LogData that I am serializing under compact framework 3.5, transmitting to a server (running .Net framework 4.0), which then deserializes. Sometimes it works and sometimes it throws the above error and I have yet to narrow it down to any specific cause. I've done many many tests with different values and can't seem to find any rhyme or

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

扶醉桌前 提交于 2019-12-20 11:07:49
问题 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 just wrote the value of every property into an array of bytes without any metadata. I know protobuf-net supports string interning if you set AsReference to true , but I'm not doing that in this case, so does protobuf-net provide some compression by

Protocol buffers in C# projects using protobuf-net - best practices for code generation

做~自己de王妃 提交于 2019-12-20 08:43:58
问题 I'm trying to use protobuf in a C# project, using protobuf-net, and am wondering what is the best way to organise this into a Visual Studio project structure. When manually using the protogen tool to generate code into C#, life seems easy but it doesn't feel right. I'd like the .proto file to be considered to be the primary source-code file, generating C# files as a by-product, but before the C# compiler gets involved. The options seem to be: Custom tool for proto tools (although I can't see

protobuf-net and interface support

若如初见. 提交于 2019-12-20 03:56:17
问题 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; } [DataMember(Order = 2)] public IPayload Payload { get; set; } } [ProtoContract] [ProtoInclude(1, typeof(Payload))] public interface IPayload { int Field4 { get; set; } } [DataContract] public class

Interfaces with protobuf-net and C#

走远了吗. 提交于 2019-12-20 01:35:41
问题 Does anybody know what is the right way to set up a ProtoContract for an Interface ? I get the following exception " The type cannot be changed once a serializer has been generated " using only attributes. Code used: [ProtoContract] public class Lesson5TestClass2 : ILesson5TestInteface1 { [ProtoMember(1)] public string Name { get; set; } [ProtoMember(2)] public string Phone { get; set; } } [ProtoContract] [ProtoInclude(1000, typeof(Lesson5TestClass2))] public interface ILesson5TestInteface1 {

protobuf-net Serializing System.Object With DynamicType Throws Exception

自作多情 提交于 2019-12-19 21:51:33
问题 In my application, I'm serializing messages to send over the wire using protobuf-net. Each message has a list of key-value pairs for header information. However, I'm running into an exception and I've been able to reproduce it with a very simplified example: [TestFixture] public class SerializationTests { [ProtoContract] public class MyType { [ProtoMember(1, DynamicType = true)] public object Property { get; set; } } [Test] public void SerializationTest() { var myType = new MyType {Property =

Using Protobuf-Net In Xamarin.iOS without full AOT

情到浓时终转凉″ 提交于 2019-12-19 10:55:13
问题 Is there any alternative to achieving serialising and deserialising of objects in Xamarin.iOS (Monotouch) using protobuf-net other than this method: http://www.frictionpointstudios.com/blog/2011/3/31/using-protobuf-net-serialization-in-unity-iphone.html Reading around some people claim they have managed it (without giving evidence), but my understanding is that [iOS JIT==NO] so does not quite make sense. If the only possible solution is to fully AOT all relevant classes what might a suitable