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

[DRAFT] TypeNameParser #97864

Closed
wants to merge 14 commits into from
Closed

Conversation

adamsitnik
Copy link
Member

I am opening this PR to test my initial implementation for #97566.

It has plenty of TODOs and it's going to change (especially the public API surface and test coverage (separate PR)), for now I just want to see if there are any failing tests.

@ghost
Copy link

ghost commented Feb 2, 2024

Tagging subscribers to this area: @dotnet/area-system-reflection-metadata
See info in area-owners.md if you want to be subscribed.

Issue Details

I am opening this PR to test my initial implementation for #97566.

It has plenty of TODOs and it's going to change (especially the public API surface and test coverage (separate PR)), for now I just want to see if there are any failing tests.

Author: adamsitnik
Assignees: adamsitnik
Labels:

area-System.Reflection.Metadata

Milestone: -

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.


namespace System.Reflection.Metadata
{
#if SYSTEM_PRIVATE_CORELIB
Copy link

Choose a reason for hiding this comment

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

Just to help with my ignorance, this is internal in CoreLib because you want to make it available in netstandard2.0 via System.Reflection.Metadata so to avoid name collision you keep the one in CoreLib private?

#if SYSTEM_PRIVATE_CORELIB
throw new ArgumentException(SR.Arg_ArgumentException, $"typeName@{errorIndex}");
#else
throw new ArgumentException("SR.Argument_InvalidTypeName");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new ArgumentException("SR.Argument_InvalidTypeName");
throw new ArgumentException(SR.Argument_InvalidTypeName);

Perhaps you meant to reference a resource here?

internal partial struct TypeNameParser
{
#if NETCOREAPP
private static ReadOnlySpan<char> CharsToEscape => "\\[]+*&,";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could use .NET 8's SearchValues<char> here? e.g.

Suggested change
private static ReadOnlySpan<char> CharsToEscape => "\\[]+*&,";
#if NET8_0_OR_GREATER
private static readonly SearchValues<char> CharsToEscape = SearchValues.Create("\\[]+*&,");
#else
private static ReadOnlySpan<char> CharsToEscape => "\\[]+*&,";
#endif

@adamsitnik adamsitnik closed this Feb 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants