[Mono-bugs] [Bug 53919][Wis] Changed - Convert.ChangeType fails to convert TimeSpan objects
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 5 Feb 2004 10:20:10 -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 ianm@activestate.com.
http://bugzilla.ximian.com/show_bug.cgi?id=53919
--- shadow/53919 2004-02-05 10:18:42.000000000 -0500
+++ shadow/53919.tmp.24809 2004-02-05 10:20:10.000000000 -0500
@@ -1,14 +1,14 @@
Bug#: 53919
Product: Mono/Class Libraries
Version: unspecified
-OS:
+OS: unknown
OS Details: gentoo
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Wishlist
Component: CORLIB
AssignedTo: mono-bugs@ximian.com
ReportedBy: ianm@activestate.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -51,6 +51,20 @@
TimeSpan - although I didn't test other object types exhaustively.
------- Additional Comments From ianm@activestate.com 2004-02-05 10:18 -------
Created an attachment (id=6616)
patch to Convert.cs that always lets a Convert.ChangeType call succeed if the source object is already of the destination type.
+
+------- Additional Comments From ianm@activestate.com 2004-02-05 10:20 -------
+Looking further it looks like Convert.cs is only doing the conversion
+if the source type implements IConvertible - giving only the 17 type
+conversions available from the IConvertible interface.
+It should probably do a check to see if the type of the source is the
+same as the destination and if so just return the source object.
+I thought at first that ms .net must be using the associated
+TypeConverter but it seems that is not the case since a string to
+TimeSpan conversion using Convert.ChangeType also fails ( on ms.net).
+
+so anyway I've attached a patch to Convert.cs that always lets a
+Convert.ChangeType call succeed if the source object is already of the
+destination type