[Mono-bugs] [Bug 32269][Nor] New - Cast from enum variable to System.Enum gives null

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
14 Oct 2002 18:05:45 -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 andy@nobugs.org.

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

--- shadow/32269	Mon Oct 14 14:05:45 2002
+++ shadow/32269.tmp.12009	Mon Oct 14 14:05:45 2002
@@ -0,0 +1,50 @@
+Bug#: 32269
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: andy@nobugs.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Cast from enum variable to System.Enum gives null
+
+Build and run the following:
+
+using System;
+
+class Test {
+
+        public enum MyEnum { A, B, C };
+
+        public static void Main() 
+        {
+                MyEnum me = MyEnum.A;
+                System.Enum se = (System.Enum) me;
+                IConvertible ic = (IConvertible) se;
+                if (ic == null) {
+                Console.WriteLine("null");
+                }
+        }
+}
+
+Actual Results:
+
+It prints 'null'
+
+Expected Results:
+
+Under csc/ms runtime it gives no output.
+
+Additional Information:
+
+Actually, it's the cast from MyEnum to System.Enum gives null on mono. 
+However, I've left the code snippet exactly as it was when I tested it on a
+windows box at work today, so I'm sure of the behaviour on windows.