Open saquibmian opened 5 hours ago
I agree we shouldn't generate invalid code. Whether just _
is the right name to generate is up for discussion, given that _
has a "somewhat" special meaning in C#. (For an enum value that make be okay - for a field it could be pretty confusing. It's worth thinking about how it might be used in all contexts rather than just enums.)
I think it's unlikely that we're going to get to this corner case any time soon - but if you have the time to create a PR to change the C# generator code to fix this, I'd happily review it.
What version of protobuf and what language are you using? Version: v28.3 Language: C#
What operating system (Linux, Windows, ...) and version? macOS
What runtime / compiler are you using (e.g., python version or gcc version) protoc
What did you do? Steps to reproduce the behavior:
Write
foo.proto
with the following content.protoc -I . --csharp_out=. foo.proto
What did you expect to see
Foo.cs
should contain the following definition:What did you see instead?
Foo.cs
contains the following definition, which does not compile (missing enum name):Anything else we should know about your project / environment Nothing else.