[Mono-bugs] [Bug 655089] New: XmlConvert.ToDateTime with simple date and XmlDateTimeSerializationMode.Local throws FormatException
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Nov 19 17:26:51 EST 2010
https://bugzilla.novell.com/show_bug.cgi?id=655089
https://bugzilla.novell.com/show_bug.cgi?id=655089#c0
Summary: XmlConvert.ToDateTime with simple date and
XmlDateTimeSerializationMode.Local throws
FormatException
Classification: Mono
Product: Mono: Class Libraries
Version: 2.8.x
Platform: Macintosh
OS/Version: Mac OS X 10.6
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.XML
AssignedTo: atsushi at ximian.com
ReportedBy: azizatif at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;
Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Media Center PC 5.0; SLCC1;
Tablet PC 2.0; MS-RTC LM 8)
Calling XmlConvert.ToDateTime with a simple date string like "2010-11-10" and
XmlDateTimeSerializationMode.Local throws FormationException.
Reproducible: Always
Steps to Reproduce:
1. Run F# Interactive
2. type `open System.Xml` then press ENTER
3. type `XmlConvert.ToDateTime("2010-11-10",
XmlDateTimeSerializationMode.Local);;` then press ENTER
Actual Results:
Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System.Xml;;
> let d = XmlConvert.ToDateTime("2010-11-10", XmlDateTimeSerializationMode.Local);;
System.FormatException: Invalid format string
at System.DateTime.ParseExact (System.String s, System.String[] formats,
IFormatProvider provider, DateTimeStyles style) [0x00000] in <filename
unknown>:0
at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[]
formats, DateTimeStyles style) [0x00000] in <filename unknown>:0
at System.Xml.XmlConvert.ToDateTime (System.String s, System.String[]
formats) [0x00000] in <filename unknown>:0
at System.Xml.XmlConvert.ToDateTime (System.String value,
XmlDateTimeSerializationMode mode) [0x00000] in <filename unknown>:0
at <StartupCode$FSI_0004>.$FSI_0004.main@ () [0x00000] in <filename
unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(System.Reflection.MonoMethod*,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Stopped due to error
>
Expected Results:
Microsoft (R) F# 2.0 Interactive build 4.0.30319.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System.Xml;;
> XmlConvert.ToDateTime("2010-11-10", XmlDateTimeSerializationMode.Local);;
val it : System.DateTime =
11/10/2010 12:00:00 AM {Date = 11/10/2010 12:00:00 AM;
Day = 10;
DayOfWeek = Wednesday;
DayOfYear = 314;
Hour = 0;
Kind = Local;
Millisecond = 0;
Minute = 0;
Month = 11;
Second = 0;
Ticks = 634249440000000000L;
TimeOfDay = 00:00:00;
Year = 2010;}
>
It appears XmlConvert.ToDateTime has not trouble converting "2010-11-10" to a
DateTime value when one of the other XmlDateTimeSerializationMode enumeration
values are specified. Only Local causes FormatException to be thrown.
The same test on Microsoft .NET Framework 4.0 on Windows 7 successfully parses
"2010-11-10" with XmlDateTimeSerializationMode.Local.
--
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