I’ve been working on a side project at home the last few days to snipe hard to find restaurant reservations and came across a weird issue I’ve never experienced before while using the .NET framework.

The API I’m calling to find these opportunities returns a DateTime value in the format “2016-11-21T23:00:00-05:00” which could be read as “November 21st, 2016 11:00pm (EST)”. Now while we’ve read the “-05:00” as the timezone offset which equates to the Eastern Time Zone, it appears the .NET framework in the DateTime.Parse() method, takes that as a hint to adjust the value relative to the local timezone instead to “November 22nd, 2016 4:00am”. Can’t imagine any restaurant that is hard to get is open at 4am in the local time.

While on my laptop (using EST) it was working just fine, deploying this to say… an Azure instance (using UTC) introduces just enough frustration to want to kick puppies and pop a small child’s balloon in passing.

I’ve seen it for years in the intellisense popup in Visual Studio without ever looking at it, and now I know why it’s there. The lifesaving DateTimeOffset type works just like the DateTime type, but when fed the value I needed parsed instead sees the timezone value as an offset (thus the type’s name), not an adjustment hint.

 

Hopefully you see this before you do anything horrible to a young canine or child. For the record, doing either is mean. Asshole.

If you’ve ever had problems trying to target particular .NET frameworks, this cheat sheet put together by @bradwilson@onovotny, and myself a while ago might help. I’m not going to go into depth on about what PCLs are what targeting means with the new frameworks – I think Oren Novotny did a great job over on his blog with his articles…

Below is a static image of it at the time of this blog posting, or you can see the live version which will reflect updates shared here on OneDrive. I suggest opening it in the full fledged Excel as vertically rotated columns don’t render in the online version. If you see any updates that are needed, you can contact me on Twitter @William_Holroyd.

Continue reading

I’m having a hard time trying to understand how Microsoft open sourcing .NET is going to help them, at least financially. I get that developers want to have the option of running on Linux, and that by doing this, they win the development community. Microsoft has a horrible history of not always choosing right over profitable.

With the status quo prior to this last week, the use of .NET on non-Windows machines meant you were a year or so behind the curve by using Mono. At least depending on what you wanted to implement – some of the asynchronous parts of the MVC framework is still out of reach, and both WPF and WCF were left entirely unimplemented.Continue reading