Setting a google.protobuf.Int32Value field as 0 causes deserialization error

469 views
Skip to first unread message

Denis Lyons

unread,
Feb 26, 2021, 10:31:01 AM2/26/21
to Protocol Buffers
Hi all, I'm using v3.15.2 C# libraries and trying to implement a nullable int field.  I am using the google.protobuf.Int32Value wrapper type however whenever I set the field value to 0 I get an InvalidProtocolBufferException on the receiving side when calling IMessage::MergeFrom(CodedInputStream input) to deserialize the received message. Below is my pretty simple proto definition

message EchoTest {
    string message = 1;
    google.protobuf.Int32Value number = 2;
}

Note that this exception is only thrown when setting 'number' to 0, not setting 'number' at all or setting it to a non-zero value works fine, any ideas what may be wrong?

Thanks!
Reply all
Reply to author
Forward
0 new messages