Open Almazis opened 1 year ago
Simple usage of DateTime constructor
public static DateTime DateTimeConstructor() { var res = new DateTime(2022, 1, 1); return res; }
generates the test with expected NullReferenceException
Before exception is generated (in ILInterpreter member x.Raise) ipstack:
ILInterpreter member x.Raise
[0] Instruction (54, System.UInt64 System.DateTime.DateToTicks(System.Int32, System.Int32, System.Int32)) [1] Instruction (4, System.Void System.DateTime..ctor(this, System.Int32, System.Int32, System.Int32)) [2] Instruction (7, System.DateTime IntegrationTests.Environment.DateTimeConstructor())
The latest frame points to if ((uint)day > days[month] - days[month - 1]) where array days is loaded from a static member :
if ((uint)day > days[month] - days[month - 1])
private static readonly uint[] s_daysToMonth365 = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; private static readonly uint[] s_daysToMonth366 = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; <...> uint[] days = IsLeapYear(year) ? s_daysToMonth366 : s_daysToMonth365;
Possible reason for false NullReferenceException are uninitialized statics.
Simple usage of DateTime constructor
generates the test with expected NullReferenceException
Before exception is generated (in
ILInterpreter member x.Raise
) ipstack:The latest frame points to
if ((uint)day > days[month] - days[month - 1])
where array days is loaded from a static member :Possible reason for false NullReferenceException are uninitialized statics.