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

MailAddress.TryCreate: allow null for the address argument #70920

Closed
danlyons-home opened this issue Jun 17, 2022 · 2 comments · Fixed by #70943
Closed

MailAddress.TryCreate: allow null for the address argument #70920

danlyons-home opened this issue Jun 17, 2022 · 2 comments · Fixed by #70943
Assignees
Milestone

Comments

@danlyons-home
Copy link

MailAddress.TryCreate overloads currently require address be a non-null string. However, the method already handles validating null/empty values without throwing an exception (#47515).

Annotating the argument to allow null would save callers with #nullable enabled from either having to add a redundant null-check for address or a null-forgiving operator.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 17, 2022
@stephentoub
Copy link
Member

Thanks for pointing this out. Yes, the string address argument for all three TryCreate overloads should be [NotNullWhen(true)] string? address.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 18, 2022
@stephentoub stephentoub self-assigned this Jun 18, 2022
@stephentoub stephentoub added this to the 7.0.0 milestone Jun 18, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 18, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants