Bug 163 - DataContractJsonSerializer does not deserialize date correctly
Summary: DataContractJsonSerializer does not deserialize date correctly
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: 2.10.x
Hardware: Macintosh Mac OS
: High major
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-03 14:33 UTC by Bart
Modified: 2015-04-20 04:27 UTC (History)
4 users (show)

Tags: DataContractJsonSerializer System.ServiceModel.Web
Is this bug a regression?: ---
Last known good build:


Attachments
VS2010 Test solution (2.94 KB, application/zip)
2011-08-03 14:33 UTC, Bart
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Bart 2011-08-03 14:33:59 UTC
Created attachment 58 [details]
VS2010 Test solution

I have come across a scenario where the DataContractJsonSerializer does not correctly deserialize the date "6/24/2010 12:00:00 AM" correctly. I ran my test project on my PC using Visual Studio and the value is deserialized correctly. However, when I run the test on my Mac using Mono, it pulls back 01/01/0001.

I have attached a test project which demos the scenario.

From Mono on Mac:

Starting Test
1/1/0001 12:00:00 AM
Finished Test

Press any key to continue...

From PC on Windows:

Starting Test
6/24/2010 12:00:00 AM
Finished Test
Press any key to continue . . .
Comment 1 Miguel de Icaza [MSFT] 2011-11-24 01:33:52 UTC
Fixed on master and mono-2-10
Comment 2 Atsushi Eno 2015-04-20 04:27:40 UTC
The added test was wrong and did not consider the fact that it is TimeZone dependent. Hence the test also failed on .NET Framework. I revised it so that it won't get stuck when we import referencesource. See also https://bugzilla.novell.com/show_bug.cgi?id=586169