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

Element type parsers should return null, not default instances #2749

Closed
ewoutkramer opened this issue Mar 27, 2024 · 0 comments · Fixed by #2752
Closed

Element type parsers should return null, not default instances #2749

ewoutkramer opened this issue Mar 27, 2024 · 0 comments · Fixed by #2752
Assignees

Comments

@ewoutkramer
Copy link
Member

E.g. DateTime.TryParse in the system types (namespace Element) currently has a non-nullable out parameter, which is set to default values (e.g. a DateTime with a minimal date) when the parse function returns false.

We should change this to nullables with a [NotNullWhen] attribute added to them.

This might be breaking, although the caller is not supposed to actually do something with the return value when the function returns false, so the consequences would be minor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants