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
[DRAFT] TypeNameParser #97864
Conversation
- allow ignoring errors (return null) - assembly name parsing
- report errorIndex in the ex message - fix Full Framework build - fix nested types support - implement NativeAOT part
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata Issue DetailsI 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.
|
Note regarding the 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 |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 => "\\[]+*&,"; |
There was a problem hiding this comment.
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.
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 |
… methods, move "allowFullyQualifiedName" to Options bag
a31f97e
to
ee43e71
Compare
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.