[Mono-bugs] [Bug 60253][Nor] New - Beta 3 bug in DateTime allowing values less than MinValue.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 16 Jun 2004 02:05:01 -0400 (EDT)


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 davidandrewtaylor@hotmail.com.

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

--- shadow/60253	2004-06-16 02:05:01.000000000 -0400
+++ shadow/60253.tmp.15644	2004-06-16 02:05:01.000000000 -0400
@@ -0,0 +1,58 @@
+Bug#: 60253
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Beta 3 bug in DateTime allowing values less than MinValue.
+
+Description of Problem:
+I am in the Eastern Australia timezone.  Checkout these lines:
+    DateTime time = DateTime.MinValue;
+    time = time.ToUniversalTime();
+    Console.WriteLine("Time is : " + time);
+In MS.NET the result is reported as: 1/01/0001 12:00:00 AM
+In MONO Beta 3 the result reported : 1/01/0001 -11:00:00 AM
+
+This is clearly a bug as the negative value does not make any sense and 
+is "Less" than the Minimum value for the DateTime object.
+
+In my testcase I then go on to add a value as in "time.AddHours(0);" and 
+this throws an exception in MONO (probably because of the illegal value 
+the DateTime object is holding).
+
+Steps to reproduce the problem:
+1. Run my testcase test.cs
+
+Actual Results:
+Time is : 1/01/0001 -11:00:00 AM
+Trying to add 0 hours...
+ 
+Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out 
+of
+range.
+in <0x000cd> System.DateTime:AddTicks (long)
+in <0x000e8> System.DateTime:AddMilliseconds (double)
+in <0x00022> System.DateTime:AddHours (double)
+in <0x000a1> test:Main ()
+
+Expected Results:
+Time is : 1/01/0001 12:00:00 AM
+Trying to add 0 hours...
+
+How often does this happen? 
+All the time (but you might need to be in my timezone to make sure it 
+tries a negative value).
+
+Additional Information:
+See the testcase.