Extend C# nullable analysis to check for nullable field/property assignments in methods called by constructors #42531
Labels
Area-Compilers
Feature - Nullable Reference Types
Nullable Reference Types
Resolution-Duplicate
The described behavior is tracked in another issue
Milestone
Version Used: C# 8.0, C# Tools 3.6.0-1.20127.6+572b1f0e0da95fd92af710ee58c95e2257cb08e3
Steps to Reproduce:
Example:
Expected Behavior: The compiler detects that
myField
is initialized inInitialize()
, which is called by the constructor, and does not issue a warning.Actual Behavior: The compiler issues
Warning CS8618: Non-nullable field 'myField' is uninitialized. Consider declaring the field as nullable.
on the constructor's line.The text was updated successfully, but these errors were encountered: