[Mono-bugs] [Bug 23946] New - Convert.ChangeType fails on TypeBuilder-created types

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
27 Apr 2002 14:55:36 -0000


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 martin@gnome.org.

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

--- shadow/23946	Sat Apr 27 10:55:36 2002
+++ shadow/23946.tmp.2462	Sat Apr 27 10:55:36 2002
@@ -0,0 +1,35 @@
+Bug#: 23946
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: Windows
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: martin@gnome.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Convert.ChangeType fails on TypeBuilder-created types
+
+When compiling with --nostdlib, MCS creates all the standard types
+(System.Int32 etc.) using TypeBuilder.
+
+In Enum.LookupEnumValue, UnderlyingType is the new "System.Int32" type
+which has been created by TypeBuilder and default_value is an integer 
+value of the "real" System.Int32 type.
+
+This makes the
+
+	default_value = Convert.ChangeType (default_value, 
+UnderlyingType);
+
+fail with an InvalidCastException - the IConvertible interface of 
+mscorlib's System.Int32 type doesn't know anything about the new 
+"System.Int32" type.
+
+Martin