Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify XML comments for Utf8Parser.TryParse to reflect case insensitivity #103861

Merged
merged 9 commits into from
Sep 11, 2024

Conversation

joegoldman2
Copy link
Contributor

Fixes #100659.

I will also update the doc in https://github.com/dotnet/dotnet-api-docs if this PR is accepted.

/// <param name="bytesConsumed">On a successful parse, receives the length in bytes of the substring that was parsed </param>
/// <param name="standardFormat">Expected format of the Utf8 string</param>
/// <param name="bytesConsumed">On a successful parse, receives the length in bytes of the substring that was parsed</param>
/// <param name="standardFormat">Expected format of the Utf8 string. Supported formats are G and l.</param>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A clarification on formats has been added because the current implementation checks the format without using it afterwards.

if (!(standardFormat == default(char) || standardFormat == 'G' || standardFormat == 'l'))
ThrowHelper.ThrowFormatException_BadFormatSpecifier();

Should this check be removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional so the logic isn't blocked from supporting future format specifiers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I won't change this validation.

@jeffhandley
Copy link
Member

Thank you, @joegoldman2. I'd like @tannergooding or @GrabYourPitchforks to review particularly your question that you left about whether the check should be removed. It might be another week or two though.

joegoldman2 and others added 2 commits August 17, 2024 10:38
…tf8Parser/Utf8Parser.Boolean.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
@tannergooding tannergooding merged commit a3365e4 into dotnet:main Sep 11, 2024
148 checks passed
@joegoldman2 joegoldman2 deleted the utf8parser-tryparse-doc branch September 11, 2024 17:38
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
…ivity (dotnet#103861)

* Clarify XML comments for Utf8Parser.TryParse to reflect case insensitivity

* Clarify doc

* Update doc

* Update src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Boolean.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>

* Update src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Boolean.cs

---------

Co-authored-by: joegoldman2 <147369450+joegoldman@users.noreply.github.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Memory community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Utf8Parser.TryParse ignores the provided format for bool
3 participants