diff --git a/csharp/src/Google.Protobuf/ParseContext.cs b/csharp/src/Google.Protobuf/ParseContext.cs index 85ea56737a..58a3eef45a 100644 --- a/csharp/src/Google.Protobuf/ParseContext.cs +++ b/csharp/src/Google.Protobuf/ParseContext.cs @@ -64,8 +64,9 @@ namespace Google.Protobuf state.recursionLimit = DefaultRecursionLimit; state.currentLimit = int.MaxValue; state.bufferSize = buffer.Length; - - Initialize(buffer, ref state, out ctx); + // Equivalent to Initialize(buffer, ref state, out ctx); + ctx.buffer = buffer; + ctx.state = state; } /// <summary> @@ -74,6 +75,7 @@ namespace Google.Protobuf [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Initialize(ReadOnlySpan<byte> buffer, ref ParserInternalState state, out ParseContext ctx) { + // Note: if this code ever changes, also change the initialization above. ctx.buffer = buffer; ctx.state = state; }