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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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.

/// <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. The default value is also accepted.</param>
Copy link
Member

Choose a reason for hiding this comment

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

What about:

Suggested change
/// <param name="standardFormat">Expected format of the Utf8 string. Supported formats are G and l. The default value is also accepted.</param>
/// <param name="standardFormat">Expected format of the Utf8 string. Supported formats are <c>'G'</c>, <c>'l'</c>, and <c>default</c>.</param>

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