var reader = new Utf8JsonReader(utf8Json, isFinalBlock: true, readerState);
object result = ReadCore(returnType, options, ref reader);
- readerState = reader.CurrentState;
- if (readerState.BytesConsumed != utf8Json.Length)
+ if (reader.BytesConsumed != utf8Json.Length)
{
+ readerState = reader.CurrentState;
throw new JsonReaderException(SR.Format(SR.DeserializeDataRemaining,
utf8Json.Length, utf8Json.Length - readerState.BytesConsumed), readerState);
}
var reader = new Utf8JsonReader(jsonBytes, isFinalBlock: true, readerState);
object result = ReadCore(returnType, options, ref reader);
- readerState = reader.CurrentState;
- if (readerState.BytesConsumed != jsonBytes.Length)
+ if (reader.BytesConsumed != jsonBytes.Length)
{
+ readerState = reader.CurrentState;
throw new JsonReaderException(SR.Format(SR.DeserializeDataRemaining,
jsonBytes.Length, jsonBytes.Length - readerState.BytesConsumed), readerState);
}