This looks like issue 8101 
<https://github.com/protocolbuffers/protobuf/issues/8101>, which was fixed 
very recently (PR 10268 
<https://github.com/protocolbuffers/protobuf/pull/10268>).  Unfortunately I 
don't believe it's been included in a release yet, but you could fetch the 
latest code to build a version of protoc with the fix, or temporarily 
manually patch the generated code to add an underscore (so _400Url and 
_400Url_).


On Thursday, 11 August 2022 at 14:15:28 UTC+1 wulun00 wrote:

> I tried to convert a proto file that contains fields beginning with 
> underscores to a c# file, but it cannot be converted to the correct CS file
> example:
> msg.proto
> syntax = "proto2";
> message Msg {
>   optional string _400Url = 1;
> }
>
> Msg.cs 
> /// <summary>Field number for the "_400Url" field.</summary>
> public const int 400UrlFieldNumber = 1;
> private readonly static string 400UrlDefaultValue = "";
>
> private string 400Url_;
> [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
> [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
> public string 400Url {
> get { return 400Url_ ?? 400UrlDefaultValue; }
> set {
> 400Url_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
> }
> }
>
> Unable to compile because of 400Url
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/9f73b9de-8d02-4eb7-82ba-bd35a1071e2an%40googlegroups.com.

Reply via email to