Skip to content

Commit 2d54736

Browse files
don't assert when validation is skipped (#111596)
1 parent c32f8d0 commit 2d54736

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/libraries/Fuzzing/DotnetFuzzing/Fuzzers/Utf8JsonWriterFuzzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void FuzzTarget(ReadOnlySpan<byte> bytes)
119119
}
120120

121121
// Additional test for mixing UTF-8 and UTF-16 encoding. The alignment math is easier in UTF-16 mode so just run it for that.
122-
if (encoding == Utf16EncodingFlag)
122+
if (encoding == Utf16EncodingFlag && !options.SkipValidation)
123123
{
124124
Array.Clear(expectedBuffer);
125125

src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.StringSegment.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public sealed partial class Utf8JsonWriter
1818
/// Thrown when the specified value is too large.
1919
/// </exception>
2020
/// <exception cref="InvalidOperationException">
21-
/// Thrown if this would result in invalid JSON being written (while validation is enabled) or
21+
/// Thrown when validation is enabled if this would result in invalid JSON being written or
2222
/// if the previously written segment (if any) was not written with this same overload.
2323
/// </exception>
2424
/// <remarks>
@@ -186,7 +186,7 @@ private void WriteStringSegmentData(ReadOnlySpan<char> escapedValue)
186186
/// Thrown when the specified value is too large.
187187
/// </exception>
188188
/// <exception cref="InvalidOperationException">
189-
/// Thrown if this would result in invalid JSON being written (while validation is enabled) or
189+
/// Thrown when validation is enabled if this would result in invalid JSON being written or
190190
/// if the previously written segment (if any) was not written with this same overload.
191191
/// </exception>
192192
/// <remarks>
@@ -353,7 +353,7 @@ private void WriteStringSegmentData(ReadOnlySpan<byte> escapedValue)
353353
/// Thrown when the specified value is too large.
354354
/// </exception>
355355
/// <exception cref="InvalidOperationException">
356-
/// Thrown if this would result in invalid JSON being written (while validation is enabled) or
356+
/// Thrown when validation is enabled if this would result in invalid JSON being written or
357357
/// if the previously written segment (if any) was not written with this same overload.
358358
/// </exception>
359359
public void WriteBase64StringSegment(ReadOnlySpan<byte> value, bool isFinalSegment)

0 commit comments

Comments
 (0)