-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Warning about null value while value is set as not null #65406
Comments
Probably the same as #43587 |
@333fred to confirm dupe |
Unrelated. I'm not sure whether we really support this scenario, however. We generally don't process property bodies when considering nullability of fields, but we might make an exception for MemberNotNull of required properties. We'll need to run it by LDM. |
dotnet/csharplang#6754 will be discussed by LDM on Wednesday. There are some subtleties to this request: chained constructors, in particular, are more difficult than they appear on the surface, as we would need to use |
* Support MemberNotNull on required members in nullable analysis Fixes dotnet/csharplang#6754, #65406. * Handle and add test for IDE-discovered scenario. * PR feedback.
…t#65987) * Support MemberNotNull on required members in nullable analysis Fixes dotnet/csharplang#6754, dotnet#65406. * Handle and add test for IDE-discovered scenario. * PR feedback.
Version Used:
Visual Studio 17.4.0
Steps to Reproduce:
Diagnostic Id:
Expected Behavior:
No warning.
The field
_s
is not null afterinit
block which specifies it usingMemberNotNullAttribute
.Actual Behavior:
Warning about making
_s
to be nullable.The text was updated successfully, but these errors were encountered: