Thank you for the pointers Adam. The string did not match the file on disk because I neglected to open the file in binary mode. Commenting out the custom option coincidentally made everything work leading me down the rat hole but the real fix is to open in binary mode and then everything works. Best, Marc From: Adam Cozzette I don't think this necessarily has anything to do with the custom option. FileDescriptorSet is itself just a protocol buffer message, so parsing it doesn't involve interpreting the meaning of its contents. It's just like parsing any other proto, so if it's failing then either the descriptors were somehow corrupted or are not being read from disk successfully. Here is what I would suggest trying: 1. Run this and make sure the results look reasonable: protoc --decode_raw < simple.desc This will print out the raw field numbers and values in the descriptor. 2. Change your code to read in a string and then parse the string (with ParseFromString instead of ParseFromIstream). This way you can verify that the string you read in exactly matches the file on disk (or at least do a quick check to verify that the length is the same). On Fri, Feb 12, 2021 at 1:37 PM Marc Schafer <space...@plunk.org> wrote:
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 protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/753AC0B4-72C1-4D0B-B9C5-2525780BA7DC%40hxcore.ol. |
- [protobuf] Parsing of .desc fails for... Marc Schafer
- Re: [protobuf] Parsing of .desc ... 'Adam Cozzette' via Protocol Buffers
- RE: [protobuf] Parsing of .d... Marc Schafer
- Re: [protobuf] Parsing o... 'Adam Cozzette' via Protocol Buffers
- RE: [protobuf] Parsi... Marc Schafer