[Mono-bugs] [Bug 38674][Nor] Changed - TimeSpan.MinValue.Negate () does not throw
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Wed, 26 Feb 2003 00:28:19 -0500 (EST)
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 ndrochak@gol.com.
http://bugzilla.ximian.com/show_bug.cgi?id=38674
--- shadow/38674 Tue Feb 25 09:06:37 2003
+++ shadow/38674.tmp.4868 Wed Feb 26 00:28:18 2003
@@ -2,13 +2,13 @@
Product: Mono/Class Libraries
Version: unspecified
OS: Red Hat 8.0
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Normal
Component: CORLIB
AssignedTo: mono-bugs@ximian.com
ReportedBy: ndrochak@gol.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -25,6 +25,35 @@
public class X {
public static void Main() {
TimeSpan t1 = TimeSpan.MinValue.Negate ();
}
}
}
+
+------- Additional Comments From ndrochak@gol.com 2003-02-26 00:28 -------
+We need to control the error message displayed with the exception
+anyway, so maybe 'checked' isn't the best way to do it. Here's
+attached a proposed patch for this bug.
+
+OK to commit?
+
+Index: TimeSpan.cs
+===================================================================
+RCS file: /cvs/public/mcs/class/corlib/System/TimeSpan.cs,v
+retrieving revision 1.8
+diff -u -r1.8 TimeSpan.cs
+--- TimeSpan.cs 20 Jun 2002 12:06:21 -0000 1.8
++++ TimeSpan.cs 26 Feb 2003 05:28:05 -0000
+@@ -266,9 +266,9 @@
+
+ public TimeSpan Negate ()
+ {
+- checked {
+- return new TimeSpan (-_ticks);
+- }
++ if (_ticks == long.MinValue)
++ throw new OverflowException ("This TimeSpan
+value is MinValue and cannot be negated.")
++ return new TimeSpan (-_ticks);
+ }
+
+ public static TimeSpan Parse (string s)