EDIT: When I run this code in Visual Studio 2013, the debugger is showing Utc, not Local. It's a bug in Visual Studio 2015 Debugger.
EDIT: Have taken the code and put in stand-alone console app, but cannot reproduce in either version of VS. Bummer.
Can someone explain to me how what you see in this screenshot is possible?!
- On line 298,
endingTimePeriodStartDateis redefined as itsDatevalue but set toDateTimeKind.Utc. - On Line 300, if
endingTimePeriodStartDateis not actuallyDateTimeKind.Utc, an exception is thrown. - The debugger breakpoint on line 305 is hit, meaning the exception on line 302 was not thrown, meaning
endingTimePeriodStartDate.Kind == DateTimeKind.Utc - (I also did a
System.Diagnostic.Debug.WriteLine(endingTimePeriodStartDate.Kind)before line 305 and it prints “Utc” in the Output window). - When I look at
endingTimePeriodStartDatein the Locals and Watch debugger windows, and when I mouse hover over the variable, theKindproperty showsDateTimeKind.Local

TaskI guess you useasyncprogramming -> is it possible another thread changesendingTimePeriodStartDatein the small gap between Ln 300 and 305?new ArgumentNullException(nameof(date))in Ln 295 to eliminate "magic strings"?Task, this could still be chalked up to multi thread issues