-
I have the following code:
The last line gives me a warning with nullable reference types: Dereference of a possibly null reference. Why is this a possibly null reference? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Because nullable flow analysis does not track boolean conditions across variable assignments. I believe that there is a proposal to expand that to support trivial cases like this one, but there will always be a limit to how far flow analysis will be willing to interpret and evaluate the code to determine which code paths may or may not execute. |
Beta Was this translation helpful? Give feedback.
Because nullable flow analysis does not track boolean conditions across variable assignments. I believe that there is a proposal to expand that to support trivial cases like this one, but there will always be a limit to how far flow analysis will be willing to interpret and evaluate the code to determine which code paths may or may not execute.