-
Notifications
You must be signed in to change notification settings - Fork 414
all default value factories should be generic #1968
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
Conversation
| throw new ArgumentNullException(nameof(defaultValueFactory)); | ||
| } | ||
|
|
||
| SetDefaultValueFactory(() => defaultValueFactory()); |
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.
Why did you delete this null check? ArgumentNullException is still documented but the method no longer throws it. A null argument will instead be saved in the closure and cause NullReferenceException if the factory is called 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.
The same comment applies to the public Argument(Func<T> defaultValueFactory) constructor.
fixes #1971