[Mono-bugs] [Bug 74936][Nor] New - DateTime.Parse accepts string containing only year

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri May 13 16:14:56 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 gert.driesen@pandora.be.

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

--- shadow/74936	2005-05-13 11:14:56.000000000 -0400
+++ shadow/74936.tmp.16558	2005-05-13 11:14:56.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 74936
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DateTime.Parse accepts string containing only year
+
+Mono's DateTime.Parse(string) accepts a date string containing only a 
+year or containing an incompletely time.  MS.NET's DateTime.Parse does
+report a FormatException for these strings.
+
+To reproduce this issue, compile and run the following code:
+
+using System;
+
+public class EntryPoint {
+  public static void Main() {
+    string msg = "Should've resulted in FormatException";		
+	
+    try {
+      DateTime.Parse("1");
+      Console.WriteLine("#1: " + msg);
+    } catch (FormatException) {
+    }
+
+    try {
+      DateTime.Parse("1000");
+      Console.WriteLine("#2: " + msg);
+    } catch (FormatException) {
+    }
+
+    try {
+      DateTime.Parse("8:");
+      Console.WriteLine("#3: " + msg);
+    } catch (FormatException) {
+    }
+  }
+}
+
+Actual result:
+
+#1: Should've resulted in FormatException
+#2: Should've resulted in FormatException
+#3: Should've resulted in FormatException
+
+Expected result:
+
+(no output)



More information about the mono-bugs mailing list