Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix Utf8JsonWriter WriteXValue methods documentation to remove array-specific language#11476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gewarren merged 2 commits intomainfromcopilot/fix-11360
Jun 19, 2025

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJun 19, 2025
edited
Loading

TheWriteXValue methods inUtf8JsonWriter had documentation that incorrectly stated they write values "as an element of a JSON array". However, these methods can be used in various contexts, not just arrays:

  • As array elements:[value1, value2, value3]
  • As object property values:{"property": value}
  • As standalone JSON values (e.g., in custom converters)

Example from the issue

The problem was evident in custom converters like this:

publicoverridevoidWrite(Utf8JsonWriterwriter,DateTimeOffsetdateTimeValue,JsonSerializerOptionsoptions)=>writer.WriteStringValue(dateTimeValue.ToString(// Not writing to an array!"MM/dd/yyyy",CultureInfo.InvariantCulture));

Changes made

Updated documentation for all affectedWriteXValue methods to remove the misleading "as an element of a JSON array" language:

  • WriteStringValue (all overloads):DateTime,DateTimeOffset,Guid,ReadOnlySpan<byte>,ReadOnlySpan<char>,string,JsonEncodedText
  • WriteBooleanValue
  • WriteNullValue
  • WriteNumberValue (all numeric types):Decimal,Double,Int32,Int64,Single,UInt32,UInt64
  • WriteBase64StringValue

Before and after

Before:

<summary>Writes a string text value (as a JSON string) as an element of a JSON array.</summary>

After:

<summary>Writes a string text value (as a JSON string).</summary>

The documentation now accurately reflects that these methods write JSON values in any valid context, not just arrays.

Fixes#11360.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] Utf8JsonWriter WriteXValue methods assume an array is being written toFix Utf8JsonWriter WriteXValue methods documentation to remove array-specific languageJun 19, 2025
Copilot finished work on behalf ofjeffhandleyJune 19, 2025 06:51
@CopilotCopilotAI requested a review fromjeffhandleyJune 19, 2025 06:51
@jeffhandleyjeffhandley marked this pull request as ready for reviewJune 19, 2025 07:07
@jeffhandleyjeffhandley requested a review froma team as acode ownerJune 19, 2025 07:07
@gewarrengewarren merged commit6339fca intomainJun 19, 2025
8 checks passed
@gewarrengewarren deleted the copilot/fix-11360 branchJune 19, 2025 16:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jeffhandleyjeffhandleyjeffhandley approved these changes

@eiriktsarpaliseiriktsarpaliseiriktsarpalis approved these changes

@gewarrengewarrengewarren approved these changes

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Utf8JsonWriter WriteXValue methods assume an array is being written to
4 participants
@Copilot@jeffhandley@eiriktsarpalis@gewarren

[8]ページ先頭

©2009-2025 Movatter.jp