From 5742a64eea411db8fe18207bbe6e0b373f1df0b3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 28 May 2020 18:54:58 +0200 Subject: [PATCH] fix WriteString bug --- csharp/src/Google.Protobuf/WritingPrimitives.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csharp/src/Google.Protobuf/WritingPrimitives.cs b/csharp/src/Google.Protobuf/WritingPrimitives.cs index ec4237aa4b..573f9f7d71 100644 --- a/csharp/src/Google.Protobuf/WritingPrimitives.cs +++ b/csharp/src/Google.Protobuf/WritingPrimitives.cs @@ -165,6 +165,7 @@ namespace Google.Protobuf { buffer[state.position + i] = (byte)value[i]; } + state.position += length; } else { @@ -173,8 +174,8 @@ namespace Google.Protobuf WriteRawBytes(ref buffer, ref state, bytes); // TODO: we need to write to a span... //Utf8Encoding.GetBytes(value, 0, value.Length, buffer, state.position); + //state.position += length; } - state.position += length; } else {