Time travel issue – “Specified argument was out of the range of valid values. Parameter name: utcDate”
Few hours ago my wife told me it is time to get some rest, but since I was deep inside code resolving some interesting control flows, the time passed. I was almost done making the last tests before going to sleep when suddenly an interesting issue comes to scene… I refreshed my beautiful website to see the latest changes and ooopsss… the style is not loading properly… I thought it is something with the browser cache (since I didn’t change anything in the styles)… But it wasn’t that. I checked the same with multiple browsers, still my website was plain and ugly, without any styles…
Orite… lets check the styles and whether the paths are not (somehow) broken or if I am still able to access them…
I have three stylesheet files:
- common.css
- master.css
- style.css
Once I tried to open the red ones by navigating to their location, e.g. http://mywebsite/Content/Styles/master.css or http://mywebsite/Content/Styles/style.css, the following error message showed up:
The very first moment I was like… ops… what the hell… however, after several seconds I just looked at my clock and saw the current time is 02:04 AM. Why is important my current time with relation to the issue??? Well, it is because five minutes ago the time was 02:59… You wonder what happened? The clock got set back 1 hour because the Daylight Saving Time ended several minutes ago, October 30, at 3:00 AM (gets back 1 hour to 2:00 AM).
Ok. That’s perfectly fine, but why this confusing problem appears?
The answer is simple… The assembly was created with time 02:59 AM, 30 October, 2011. The time now is 02:04 AM, 30 October, 2011, which means we have traveled in the future :-)… hah, in other words, the assembly was last modified in future time, therefore the utcDate is out of the range of valid values.
A fast solution is to either change your time in the future or best would be to uncheck ‘Automatically adjust clock for Daylight Saving Time’
After that I simply refreshed my website and everything got back to normal!