Thanks, Jon. I can use .NET Interop to talk to the unmanaged proto-generated C++. I can have the C++ create some JSON and use PInvoke to call a C++ function to get that. There is a way! :)
On Tuesday, May 24, 2016 at 7:05:48 AM UTC-7, Jon Skeet wrote: > > No, unfortunately if they're using groups in their proto files, you won't > be able to use the proto3 C# code. > I *think* I supported groups in the proto2 port ( > https://github.com/jskeet/protobuf-csharp-port) but please be aware that > that code is not under active development, and not officially supported by > Google. > > I would suggest coming up with a strategy to move to proto3 if you > possibly can - maybe via some temporary migration tool that has the proto2 > messages as input, manually converts them to the new proto3 messages, then > saves the result. > > Jon > > > On Tuesday, 24 May 2016 02:22:27 UTC+1, Scobe S. wrote: >> >> I have a .proto file from a third-party, developed for Protobuf 2.6.1, to >> deserialize their data. I want to code my application to consume their data >> in C#. So I was trying to use proto3 to compile their .proto file into C#. >> But they have used some proto features that are not supported in proto3, >> such as group. I modified the other places in their .proto that seemed >> innocuous, like having a zero-element first in enums. If I could compile >> their .proto file with proto3, then I would have hope I could deserialize >> their data using C#. >> >> But I suspect that changes I have to make to their .proto file--esp. the >> "group" uses--will change the assumption about the wire format >> >> As a result, if I can't compile the .proto file to C#, then I have to use >> .NET Interop, if I want to write my app in C#. I have successfully compiled >> their .proto file with proto2, so I have a C++ (unmanaged) DLL with their >> proto schema in C++. But now I have to write a nasty wrapper, probably with >> COM, to marshal their .proto C++ classes over to .NET. Their .proto schema >> is not small, so writing a wrapper is not going to be fun. >> >> Any suggestions are much appreciated! >> >> >> On Saturday, May 21, 2016 at 6:22:00 AM UTC-7, Jon Skeet wrote: >>> >>> Groups are always skipped in the C# proto3 code... and the wire format >>> is different to other messages anyway. >>> >>> Are you concerned about doing this *in general*, or do you have actual >>> messages using groups that you want to parse in C#? As far as I'm aware, >>> the advice has been to avoid using groups for several years now. >>> >>> Jon >>> >>> On Saturday, 21 May 2016 04:26:10 UTC+1, Scobe S. wrote: >>>> >>>> Given a .proto file used with proto2 to generate code to send messages, >>>> is it feasible to use proto3 on the same .proto file to receive >>>> messages--assuming I alter the .proto file to be proto3 compatible? >>>> >>>> In particular, if I fix the following (which currently are errors I get >>>> when compiling the .proto file in proto3), then receiving messages should >>>> work, right? >>>> >>>> Don't use "required" or "optional". >>>> Make sure enums have a zero element as the first item. >>>> Don't use explicit default values. >>>> Do not use "group". >>>> (These are the only errors I have.) >>>> >>>> The one I am having real doubts and questions about is getting rid of >>>> "group". Using the example in the docs, I have to take something like this: >>>> >>>> message SearchResponse { >>>> repeated group Result = 1 { >>>> required string url = 2; >>>> optional string title = 3; >>>> repeated string snippets = 4; >>>> } >>>> } >>>> >>>> >>>> and make it like this: >>>> >>>> message SearchResponse { >>>> message Result { >>>> required string url = 1; >>>> optional string title = 2; >>>> repeated string snippets = 3; >>>> } >>>> repeated Result result = 1; >>>> } >>>> >>>> >>>> But this may redefine what is expected in the data over the wire. So I >>>> wonder what the best way is to replace "group" to be backward compatible. >>>> >>>> BTW, my goal is to generate C#. That's why I am using proto3. >>>> >>>> Thanks. >>>> Scobe >>>> >>>> >>>> >>>> >>>> -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
