_This issue has been moved from a ticket on Developer Community._
I'm working on migrating a project to support C# 8.0 nullable but I ran into a situation where it looks like Visual Studio isn't detecting a null value correctly. If you look at the code below in the TestClass constructor the Console.WriteLine method will throw a NullReferenceException because this.Value is null and hasn't been assigned yet. There are no warnings or errors from VS though, it thinks everything is fine here. Am I missing something, shouldn't VS be warning about this? The value is definitely null here. Thanks!
#nullable enable
namespace TestNullable
{
public static class Program
{
public static void Main(string[] args)
{
TestClass test = new TestClass("MyString");
}
public class TestClass
{
private readonly string Value;
public TestClass(string value)
{
System.Console.WriteLine(this.Value.Length.ToString());
this.Value = value;
}
}
}
}
---
### Original Comments
#### Visual Studio Feedback System on 4/21/2020, 01:46 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it鈥檚 my experience that this issue is very unlikely to be fixed.
(no solutions)
This will be fixed by #46441
Most helpful comment
This will be fixed by #46441