[Mono-bugs] [Bug 77350][Nor] New - XmlConvert.ToString(TimeSpan.FromSeconds(0)) incorrect

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 24 22:26:00 EST 2006


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 awaddell at fnfr.com.

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

--- shadow/77350	2006-01-24 22:26:00.000000000 -0500
+++ shadow/77350.tmp.26943	2006-01-24 22:26:00.000000000 -0500
@@ -0,0 +1,96 @@
+Bug#: 77350
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: awaddell at fnfr.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlConvert.ToString(TimeSpan.FromSeconds(0)) incorrect
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace XmlConvertBugTimespan0
+{
+    class Program
+    {
+        /// <summary>
+        /// Mono XmlConvert.ToString() ignores TimeSpan ticks
+        /// </summary>
+        /// <param name="args"></param>
+        static void Main(string[] args)
+        {
+            TimeSpan t1 = TimeSpan.FromSeconds(0);
+            string expected = "PT0S";
+            string s = XmlConvert.ToString(t1);
+            if (string.Compare(s, expected) != 0) {
+               
+Console.WriteLine("XmlConvert.ToString(TimeSpan.FromSeconds(0)) does not
+work properly");
+            } else {
+               
+Console.WriteLine("XmlConvert.ToString(TimeSpan.FromSeconds(0)) works
+properly");
+            }
+           
+Console.WriteLine("XmlConvert.ToString(TimeSpan.FromSeconds(0))" + s);
+            TimeSpan t2 = XmlConvert.ToTimeSpan(s);
+            if (t1.Equals(t2))
+               
+Console.WriteLine("XmlConvert.ToTimeSpan(XmlConvert.ToString(TimeSpan.FromSeconds(0)))
+works properly");
+            else
+               
+Console.WriteLine("XmlConvert.ToTimeSpan(XmlConvert.ToString(TimeSpan.FromSeconds(0)))
+has a bug");
+        }
+    }
+}
+
+
+Steps to reproduce the problem:
+1. compile and run above code
+2. 
+3. 
+
+Actual Results:
+Mono
+
+C:\svt\MonoBugs\XmlConvertBugTimespan0>mono\Debug\XmlConvertBugTimespan0.bat
+XmlConvert.ToString(TimeSpan.FromSeconds(0)) does not work properly
+XmlConvert.ToString(TimeSpan.FromSeconds(0))P
+XmlConvert.ToTimeSpan(XmlConvert.ToString(TimeSpan.FromSeconds(0))) works
+properly
+
+
+Expected Results:
+.NET
+
+C:\svt\MonoBugs\XmlConvertBugTimespan0>bin\Debug\XmlConvertBugTimespan0.exe
+XmlConvert.ToString(TimeSpan.FromSeconds(0)) works properly
+XmlConvert.ToString(TimeSpan.FromSeconds(0))PT0S
+XmlConvert.ToTimeSpan(XmlConvert.ToString(TimeSpan.FromSeconds(0))) works
+properly
+
+C:\svt\MonoBugs\XmlConvertBugTimespan0>
+
+How often does this happen? 
+always
+
+
+Additional Information:
+should match MS .NET


More information about the mono-bugs mailing list