Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide (safe) access to reflection protos in C# #9425

Closed
jskeet opened this issue Jan 20, 2022 · 2 comments · Fixed by #9426
Closed

Provide (safe) access to reflection protos in C# #9425

jskeet opened this issue Jan 20, 2022 · 2 comments · Fixed by #9426
Assignees

Comments

@jskeet
Copy link
Contributor

jskeet commented Jan 20, 2022

What language does this apply to?

C#

Describe the problem you are trying to solve.

Some APIs (e.g. BigQuery Storage use DescriptorProto for schema descriptions.

In C# we have access to reflection via the MessageDescriptor type, but there's no access to the underlying proto.

Describe the solution you'd like

ToProto() methods in all descriptor types, returning a clone of the underlying proto.

Describe alternatives you've considered

Access via .NET reflection :(

Additional context

I'll create a PR to implement this.

@jtattermusch
Copy link
Contributor

Makes sense. I think historically we had to hide the *DescriptorProto values since protobuf C# didn't have support for proto2 and the descriptor messages are proto2 messages. Not that we had proto2 support for a while, I guess we can provide access to the descriptor messages (if done in a safe way).

@jskeet
Copy link
Contributor Author

jskeet commented Jan 28, 2022

I think historically we had to hide the *DescriptorProto values since protobuf C# didn't have support for proto2 and the descriptor messages are proto2 messages.

Yes, absolutely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants