[Mono-bugs] [Bug 75396][Nor] New - Regression in DateTime.Parse

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jun 27 17:36:11 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=75396

--- shadow/75396	2005-06-27 17:36:11.000000000 -0400
+++ shadow/75396.tmp.25833	2005-06-27 17:36:11.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 75396
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: miguel at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regression in DateTime.Parse
+
+The change done in r30568 to fix bug #55978 introduce a problem.
+
+Compile the following program like this:
+
+mcs -r:System.Data sample.cs
+mono sample.exe
+
+This produces a crash:
+
+Unhandled Exception: System.InvalidCastException: Cannot cast from source
+type to destination type.
+in <0x0006f> System.Globalization.DateTimeFormatInfo:GetInstance
+(IFormatProvider provider)
+in <0x00031> System.DateTime:Parse (System.String s, IFormatProvider fp,
+DateTimeStyles styles)
+in <0x00016> System.DateTime:Parse (System.String s, IFormatProvider fp)
+in <0x0002e> System.Convert:ToDateTime (System.String value,
+IFormatProvider provider)
+in <0x00014> System.String:System.IConvertible.ToDateTime (IFormatProvider
+provider)
+in <0x005d4> System.Convert:ToType (System.Object value, System.Type
+conversionType, IFormatProvider provider)
+in <0x00032> System.Convert:ChangeType (System.Object value, System.Type
+conversionType)
+in <0x00381> Mono.Data.SqlExpressions.Comparison:Compare (IComparable o1,
+IComparable o2, Boolean caseSensitive)
+in <0x00198> Mono.Data.SqlExpressions.Comparison:EvalBoolean
+(System.Data.DataRow row)
+in <0x00084> Mono.Data.SqlExpressions.BoolOperation:EvalBoolean
+(System.Data.DataRow row)
+in <0x00046> System.Data.Common.Key:GetRecord (System.Data.DataRow row)
+in <0x0010e> System.Data.Common.Index:RebuildIndex ()
+in <0x00013> System.Data.Common.Index:EnsureArray ()
+in <0x0000a> System.Data.Common.Index:get_Array ()
+in <0x0000d> System.Data.Common.Index:GetAll ()
+in <0x00152> System.Data.DataView:UpdateIndex (Boolean force)
+in <0x000e9> System.Data.DataView:set_RowFilter (System.String value)
+in <0x00214> Foo:Main (System.String[] args)
+
+Because the call to NumberFormatInfo.GetInstance (typeof
+(DateTimeFormatInfo)) does not return null, but instead a NumberFormatInfo
+(see the commented code):
+                public object GetFormat (Type formatType)
+                {
+                        // work around
+http://bugzilla.ximian.com/show_bug.cgi?id=55978
+                        // the comparison fails because formatType likely
+comes from another domain
+                        //return (formatType == typeof (NumberFormatInfo))
+? this : null;
+                        return this;
+                }


More information about the mono-bugs mailing list