-
Notifications
You must be signed in to change notification settings - Fork 4k
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
AddNullCheck should use new parameter!
syntax
#37067
Comments
Has the compiler side of this been done? If so, i'm happy to do the IDE side. Is this currently in a branch, or in master? What langversion is it gated on? Thanks! |
@jcouv Is the compiler support in for this? |
The compiler feature is in feature branch https://github.com/dotnet/roslyn/tree/features/param-nullchecking |
@jcouv I forget, what langver is this going under? 9.0 or something sooner? |
The feature is now targeting 9.0. |
For public method, there is no guarantee that consumers will have NRT feature enabled. So, isn't it better to still offer this fix if the paramater is annotated with |
@Youssef1313: this is the fix for adding null checks at the library side of things, not the consumer side of things; the check for ? would only be if your method is directly annotated as allowing a null in that case. |
@jasonmalinowski Yes I see my comment is wrong. I don't know what I was thinking about when I wrote that 😄 |
@Youssef1313, eh, it's Monday. 😄 |
Closing out. I believe @RikkiGibson has done this. |
Instead of inserting
if (parameter is null) throw new ArgumentNullException(nameof(parameter));
, we should just mark the parameter declaration with a!
.We should also not offer this fix if the type of the parameter is annotated with
?
.FYI @fayrose @agocke
The text was updated successfully, but these errors were encountered: