[Mono-bugs] [Bug 79978][Wis] New - [PATCH] Convert.ChangeType() don't call IConvertible.ToType().

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Nov 19 04:09:42 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 redforks at gmail.com.


--- shadow/79978	2006-11-19 04:09:42.000000000 -0500
+++ shadow/79978.tmp.5635	2006-11-19 04:09:42.000000000 -0500
@@ -0,0 +1,31 @@
+Bug#: 79978
+Product: Mono: Class Libraries
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: redforks at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: [PATCH] Convert.ChangeType() don't call IConvertible.ToType().
+Convert.ChangeType() don't call IConvertible.ToType().
+When destType isn't the primitive type like Int32, Decimal,
+Convert.ChangeType should call IConvertible.ToType(). 
+I think the Convert class don't do that because Int32 ... internal types
+rely on this behavior. I made a little if statment to avoid that:
+				else if (value.GetType().Assembly == typeof(int).Assembly)
+					throw new InvalidCastException (Locale.GetText ("Unknown target
+conversion type"));
+But I stronglly suggest add a new helper function for Int32.ToType().

More information about the mono-bugs mailing list