Version Used: SharpLab x64 (unknown commit)
Steps to Reproduce:
#nullable enable
using System;
public class C1 {
string x;
public C1()
{
try
{
x = "";
}
catch (Exception)
{
x = "";
}
}
}
public class C2 {
string x;
public C2() // warning CS8618: Non-nullable field 'x' is uninitialized. Consider declaring the field as nullable.
{
try
{
x = "";
}
catch (Exception)
{
x ??= "";
}
}
}
Expected Behavior:
No warning for either C1 or C2.
Actual Behavior:
A warning (CS8618) is reported for C2.
Version Used: SharpLab x64 (unknown commit)
Steps to Reproduce:
Expected Behavior:
No warning for either
C1orC2.Actual Behavior:
A warning (CS8618) is reported for
C2.