You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Visual Studio Professional 2022
Version 17.13.0 Preview 1.0
VisualStudio.17.Preview/17.13.0-pre.1.0+35507.96
Microsoft .NET Framework
Version 4.8.09037
Steps to Reproduce:
Paste the following code into the editor
#nullable enable
public class Test
{
#nullable disable
public Test() { }
#nullable enable
public string Value { get; set; }
}
Diagnostic Id:
IDE0241 Nullable directive is unnecessary is reported for #nullable disable directive
Expected Behavior:
The directive is not reported as redundant as it turns off nullable analysis warnings in the constructor
Actual Behavior: IDE0241 Nullable directive is unnecessary is reported for #nullable disable directive
The directive is highlighted as redundant
Removing the directive introduces a compiler warning CS8618: Non-nullable property Value must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
The text was updated successfully, but these errors were encountered:
Version Used:
Steps to Reproduce:
Paste the following code into the editor
Diagnostic Id:
IDE0241 Nullable directive is unnecessary
is reported for#nullable disable
directiveExpected Behavior:
The directive is not reported as redundant as it turns off nullable analysis warnings in the constructor
Actual Behavior:
IDE0241 Nullable directive is unnecessary
is reported for#nullable disable
directiveThe directive is highlighted as redundant
Removing the directive introduces a compiler warning
CS8618: Non-nullable property
Valuemust contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
The text was updated successfully, but these errors were encountered: