Version Used:
Microsoft Visual Studio Professional 2022
Version 17.10.0 Preview 1.0
VisualStudio.17.Preview/17.10.0-pre.1.0+34607.79
Microsoft .NET Framework
Version 4.8.09037
Steps to Reproduce:
Compile and run the following code:
using System;
using System.Collections.Generic;
#nullable enable
List<string> list = [null];
Console.WriteLine(list[0].Length);
sharplab.io
Expected Behavior:
There should be a warning about mismatching nullability somewhere on the line List<string> list = [null];
Actual Behavior:
No warnings at all.
The program crashes at runtime with a NullReferenceException
Version Used:
Steps to Reproduce:
Compile and run the following code:
sharplab.io
Expected Behavior:
There should be a warning about mismatching nullability somewhere on the line
List<string> list = [null];Actual Behavior:
No warnings at all.
The program crashes at runtime with a
NullReferenceException