ServiceStack/ServiceStack.Text — pull request #124 by rrmayeriastate (2012-06-02 06:52:42+00:00)
Title: Minor fixes to DateTime serialization and JSV serializer

I ran into a couple of issues today serializing some files to disk (about 300,000 files to be exact). After this, I made a couple of changes to the code which I believe would be helpful to others. (see attached diff).

First, in ServiceStack.Text/Common/DeserializeTypeRefJsv.cs, on line 25, it was checking to see if the input string was null. That's good, but if the string is empty it will fail just as badly. Therefore, I changed that to string.IsNullOrEmpty(strType)

Next, in ServiceStack.Text/DateTimeExtensions, there is a method that converts the time to universal time (ToStableUniversalTime). Unfortunately, .NET assumes that DateTimeKind.Unspecified means local time, which is a bad assumption to make because any attempt to convert a non-utc time to utc could result in a failure if the time does not exist (for example, when switching forward into daylight savings, we lose one hour so any times within that hour do not exist). It is much safer to assume "unspecified" means UTC and go with that. Lines 132-137 of the new file reflect those changes.

Hope this helps!