private static TValue?Read <TValue>(ref Utf8JsonReader reader, JsonTypeInfo jsonTypeInfo) { Debug.Assert(jsonTypeInfo.IsConfigured); if (reader.CurrentState.Options.CommentHandling == JsonCommentHandling.Allow) { ThrowHelper.ThrowArgumentException_SerializerDoesNotSupportComments(nameof(reader)); } ReadStack state = default; state.Initialize(jsonTypeInfo); Utf8JsonReader restore = reader; try { Utf8JsonReader scopedReader = GetReaderScopedToNextValue(ref reader, ref state); return(ReadCore <TValue>(ref scopedReader, jsonTypeInfo, ref state)); } catch (JsonException) { reader = restore; throw; } }