[Mono-bugs] [Bug 690475] New: Unexpected XmlConvert.ToDateTime(string, XmlDateTimeSerializationMode) behaviour

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 28 03:39:27 EDT 2011



           Summary: Unexpected
                    ode) behaviour
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: a.selle at subsembly.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101

When converting a UTC time specification using the following method call:


the method produces the following exception:

System.FormatException: Invalid format string
  at System.DateTime.ParseExact (System.String s, System.String[] formats,
IFormatProvider provider, DateTimeStyles style) [0x0005c] in
  at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[]
formats, DateTimeStyles style) [0x00000] in
  at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[]
formats) [0x00000] in
  at System.Xml.XmlConvert.ToDateTime (System.String value,
XmlDateTimeSerializationMode mode) [0x0001d] in

The Mono implementation of this method requires that a local date time
specification is passed to the method in order to work successfully. This
behaviour, however, is different to the documented (and implemented) Microsoft
NET Framework behaviour where the parameter XmlDateTimeSerializationMode is
documented as:

"One of the XmlDateTimeSerializationMode values that specify whether the date
should be converted to local time or preserved as Coordinated Universal Time
(UTC), if it is a UTC date."

Thus the expected behaviour (which is also the actual behaviour of the MS .NET
Framework) would be that the UTC date time specification is parsed
successfully, and then converted to a local date time representation which is
returned to the caller.

Reproducible: Always

Steps to Reproduce:
Just call

Actual Results:  
System.FormatException: Invalid format string

Expected Results:  
The UTC date time specification whould be parsed successfully, and then
converted to a local DateTime instance which is returned to the caller.

I observed this when working with Mono for Android, but I think it probably
applies to all Mono class library implementations.

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

More information about the mono-bugs mailing list