-
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
Missing CS8602 for calculated property #74057
Comments
It seems, compiler incorrectly use condition "provider.NumberList != null" as proof of non-nullability of |
It is the contract of property. Nullability analysis and many other analyzers doesn't expect the get result of property to change randomly. There are also other cases that tooling can invoke the getter of properties. |
@huoyaoyuan |
Nullability analysis and potentially all language features doesn't see through method body of other methods. It only check for the signatures with attributes applied. It's also impractical to understand what can happen in a method in detail.
It's the contract of properties to act similar to simple variables. Many of the tooling including debugger follow this contract. |
Yes, of course. I supposed, that there is a simple method to distinguish cases when property has simple get accessor with hidden backing field and when property calls function. But PropertyInfo has no info for that, it seems, that it can be compiler internals only. |
Closing as by design. Only the signatures of members are examined to determine their impact on NRT analysis. |
Version Used:8.0.302, 8.0.101
Steps to Reproduce:
call dotnet build for code
Expected Behavior:
Warning CS8602
Actual Behavior:
No warning
The text was updated successfully, but these errors were encountered: