Version Used:
Branch master (14 Jan 2021)
Latest commit f3d7c35 by Julien Couvreur:
Don't check initializer on static record ctor (#50176)
Steps to Reproduce:
Compile and run the following code
#nullable enable
string s = C.MyConst;
s.ToString();
class C
{
public const string MyConst = null;
}
Expected Behavior:
Warning for public const string MyConst = null;
Actual Behavior:
No warnings. The program crashes at runtime with a NullReferenceExceptions