[Mono-bugs] [Bug 23021] New - Enum.ToObject() does not accept enum values

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
4 Apr 2002 09:32:22 -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 dihlewis@yahoo.co.uk.

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

--- shadow/23021	Thu Apr  4 04:32:22 2002
+++ shadow/23021.tmp.18926	Thu Apr  4 04:32:22 2002
@@ -0,0 +1,40 @@
+Bug#: 23021
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dihlewis@yahoo.co.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Enum.ToObject() does not accept enum values
+
+using System;
+
+enum X { A, B };
+enum Y { C, D };
+
+class Test {
+	public static void Main () {
+		object o = Enum.ToObject (typeof (Y), X.A);
+	}
+}
+
+
+This causes an ArgumentException from an assertion in 
+ves_icall_System_Enum_ToObject:
+
+Unhandled exception System.ArgumentException assertion `obj->vtable->klass-
+>byval_arg.type >= MONO_TYPE_I1 && obj->vtable->klass->byval_arg.type <= 
+MONO_TYPE_U8' failed.
+#0: 0x00000            in System.Enum::ToObject ([00BB2B90] [00BB2B30] )
+#1: 0x00010 call       in .Test::Main ()
+
+While the MS runtime accepts both boxed integrals and boxed enums.