protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

FR: C# allow the reading of repeated custom options

Open chrisdunelm opened this issue 6 years ago • 4 comments

What language does this apply to? C#

Describe the problem you are trying to solve. Read repeated custom options

Describe the solution you'd like Methods in the CustomOptions class to allow reading of repeated custom options.

Describe alternatives you've considered Currently using reflection to achieve this ;)

Additional context

chrisdunelm avatar Feb 21 '19 15:02 chrisdunelm

I'm trying to pull a repeated EnumValueOption and I'm not sure how to do it. I'm able to do this in go and it appears it's possible in c#.

I see in a few issue discussions it was decided to not support generics and also to not support repeated options. Why was this decided?

https://github.com/protocolbuffers/protobuf/pull/2317

Is there any other way to pull repeated options? I can see in my debugger that the data is all there in the descriptor, but there is no method overload to retrieve it on the CustomOptions class.

RoarkeRandall avatar Jul 23 '19 07:07 RoarkeRandall

Currently it's not possible because proto2 is not fully supported. #5936 should fix that.

jtattermusch avatar Jul 23 '19 16:07 jtattermusch

I keep reading comments that it's a proto2 feature, and not proto3, but that isn't the case. From the docs: https://developers.google.com/protocol-buffers/docs/proto3#options

Custom Options Protocol Buffers also allows you to define and use your own options. This is an advanced feature which most people don't need. If you do think you need to create your own options, see the Proto2 Language Guide for details. Note that creating custom options uses extensions, which are permitted only for custom options in proto3.

It's good to see a PR exists to add support though!

RoarkeRandall avatar Jul 23 '19 17:07 RoarkeRandall

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar May 05 '24 10:05 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar May 19 '24 10:05 github-actions[bot]