[Mono-bugs] [Bug 352210] Serialization and deserialization of datetime to and from xml, "shifts" the time with the timezone

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 5 01:35:32 EST 2008


User jdpurcell2 at yahoo.com added comment

--- Comment #9 from James Purcell <jdpurcell2 at yahoo.com>  2008-02-04 23:35:31 MST ---
Created an attachment (id=193152)
 --> (https://bugzilla.novell.com/attachment.cgi?id=193152)

As requested I have attached some examples to demonstrate the bugs I'm aware of
in Mono's current DateTime parsing.  Please see the comments in the code for
descriptions of the differences in output between MS.NET and Mono.

I believe you said you were unable to reproduce the issue of parsing returning
Local kind when it should return Unspecified.  I don't understand how this is
possible after reading the code:

result = new DateTime (false, new TimeSpan (newticks));
if (explicit_kind != DateTimeKind.Unspecified)
    result.kind = explicit_kind;
else if (use_localtime)
    result = result.ToLocalTime ();
    result.kind = DateTimeKind.Utc;

This is where the result is finally set for NET_2_0, where it will always be
caught by one of the branches of the 'if'.  In the first case .kind is set and
will obviously never be set to Unspecified, in the second case case
ToLocalTime is used which always sets Kind to Local, and in the third case
it's set to UTC.  So there is no way that _DoParse can return successfully with
Kind set to Unspecified.

Regarding the KindPattern test, you can make it pass by adding "style |=
DateTimeStyles.AdjustToUniversal;" to my patch inside "case 'K': if (s
[valuePos] == 'Z') {".

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list