Asp.net core Protobuf不允许属性为null

Asp.net core Protobuf不允许属性为null,asp.net-core,protocol-buffers,grpc,protobuf-c,Asp.net Core,Protocol Buffers,Grpc,Protobuf C,我在ASPNETCore上使用GRPC,也有这样一个模型: syntax = "proto3"; message Blob { string id = 1; string path = 2; } 问题是,当我尝试将path属性设置为null时,它会抛出ArgumentException 只需运行以下代码: new Blob { Path = null }; 结果如下: System.ArgumentNullException: Value cannot be null. (P

我在ASPNETCore上使用GRPC,也有这样一个模型:

syntax = "proto3";
message Blob {
    string id = 1;
    string path = 2;
}
问题是,当我尝试将
path
属性设置为null时,它会抛出
ArgumentException

只需运行以下代码:

new Blob { Path = null };
结果如下:

System.ArgumentNullException: Value cannot be null. (Parameter 'value')
   at Google.Protobuf.ProtoPreconditions.CheckNotNull[T](T value, String name)
   at Grpc.Blob.set_Path(String value)

Protobuf没有空的概念;proto3将en空字符串视为“默认,不发送”,这意味着
null
之间没有负载差异。所以:也许不要尝试发送
null


或者:protobuf-net(通过protobuf-net.gRPC与gRPC一起工作,它只连接到Google/Microsoft位)在这里工作正常,并且由于它不与proto3绑定,因此可以使它以不同的方式处理
null
”(发送
显式地作为零长度字符串,并且根本不发送
null
)。protobuf net不需要.proto,但如果有:

我真傻,这很有道理,谢谢你的解释。