-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Document System.Guid #3251
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
Document System.Guid #3251
Conversation
rpetrusha
left a comment
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've left some suggestions and comments, @carlossanlop.
xml/System/Guid.xml
Outdated
| ]]></format> | ||
| </remarks> | ||
| <exception cref="T:System.ArgumentNullException"><paramref name="input" /> is <see langword="null" />.</exception> |
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.
| <exception cref="T:System.ArgumentNullException"><paramref name="input" /> is <see langword="null" />.</exception> |
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.
@rpetrusha Thanks for catching this. I tested this:
static void Main(string[] args)
{
ReadOnlySpan<char> input = null;
Guid guid = Guid.Parse(input);
}and we end up throwing System.FormatException: Unrecognized Guid format.
Looking at the code for Parse, this method does not check if input is null, and it directly passes the argument to the private method TryParseGuid, which also does not check if input is null.
But it seems that calling Trim on a null ReadOnlySpan<char> will actually be calling it on an empty span. Not sure how this works, but it seems the span never becomes null. I'll dig more into this later.
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.
A span can't be null, @carlossanlop, since it's a value type.
Co-Authored-By: Ron Petrusha <[email protected]>
|
Thanks, @carlossanlop. I'll merge this PR now. |
No description provided.