Version Used:
Microsoft Visual Studio Enterprise 2019 Preview
Version 16.0.0 Preview 1.1
VisualStudio.16.Preview/16.0.0-pre.1.1+28408.50
Microsoft .NET Framework
Version 4.7.03056
Steps to Reproduce:
Compile and run the following code
#nullable enable
class C
{
C? f;
static void Main()
{
new C() { f = { f = null }};
}
}
https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQxAgrgOyQExAagB8BiTdAG3ImHLgAI5NraBYAKAAEAmOgYXYDe7OnwD8dAGYBuYXQ4BGAGxyALHQCyEAJaYAFAEpZQtiJGY4Adz4G6AyXQC8t+07KU6AXw8yTn9h6A=
Expected Behavior:
Possible derefernce of a null reference warning for f = { f = null } initializer as it dereferences a field which is explicitly marked as nullable in order to set its properties.
Actual Behavior:
No warnings for nullable reference types. The program crashes at runtime with a NullReferenceException
Version Used:
Microsoft Visual Studio Enterprise 2019 Preview
Version 16.0.0 Preview 1.1
VisualStudio.16.Preview/16.0.0-pre.1.1+28408.50
Microsoft .NET Framework
Version 4.7.03056
Steps to Reproduce:
Compile and run the following code
https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQxAgrgOyQExAagB8BiTdAG3ImHLgAI5NraBYAKAAEAmOgYXYDe7OnwD8dAGYBuYXQ4BGAGxyALHQCyEAJaYAFAEpZQtiJGY4Adz4G6AyXQC8t+07KU6AXw8yTn9h6A=
Expected Behavior:
Possible derefernce of a null referencewarning forf = { f = null }initializer as it dereferences a field which is explicitly marked as nullable in order to set its properties.Actual Behavior:
No warnings for nullable reference types. The program crashes at runtime with a
NullReferenceException