Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I need use protobuf in my windows store app and I use this Protobuf port but when I generate classes from proto file seen like not full because I dont have access to .newBuilder()... nad if I use p:lightFramework I still cannot work with .newBuilder()... Anyone can help?

Part of generated code without light framework options

[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"Person")]

Part of generated code with light framework options

[global::ProtoBuf.ProtoContract(Name=@"Person")]

Problem is there:(.newBuilder() is not recognized

CP.ConnectionResponse respp = CP.ConnectionResponse.newBuilder()...
share|improve this question
up vote 0 down vote accepted

You seem to be using two different libraries at once; in particular, you seem to be following the instructions for protobuf port, but actually using protobuf-net. These are two different libraries, connected only in so much as:

  • they both target .NET
  • they both serialize/deserialize protobuf data

To add context - this is a bit like using JSON.NET but following the instructions for ServiceStack.Text: both can serialize/deserialize JSON, but the API is different.

You need to decide which library you want to use, and follow the instructions for that implementation.

As an aside: for the best performance on a store app / windows phone app with protobuf-net, you may also want to consider using the precompiler - but you should be able to get it working (for a proof-of-concept etc) without this.

share|improve this answer
    
I need use protobuf-csharp-port but I already has to worry about the third day and I can not figure it out .( I download Version 2.4.1.521 release binaries only but I cannot generate classes from proto file. I use example and then I got this dl.dropboxusercontent.com/u/40039421/a.PNG – Pavol Franek Jul 17 '13 at 9:19
    
@user2244495 the code in your question, with ProtoBuf.ProtoContractAttribute - that is protobuf-net code. Are you sure you are using the right "protogen" ? However, as for the screenshot - you must include the --proto_path in the same command as when you call protogen – Marc Gravell Jul 17 '13 at 11:02
    
thx for your answer now I can generate classes. I have one question maybe you had similar problem. When I use my generated class in W8 app I get this error dl.dropboxusercontent.com/u/40039421/e.png – Pavol Franek Jul 18 '13 at 7:00
    
@user2244495 well, I'm the protobuf-net guy; that is protobuf port - Jon Skeet is the person you want to ask. But: a TypeInitializationException means that a static constructor threw an exception; look at the .InnerException to see exactly what actually happened – Marc Gravell Jul 18 '13 at 7:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.