[Mono-bugs] [Bug 81037][Nor] New - Type.Equals does not return true if UnderlyingSystemType matches

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Mar 5 07:29:11 EST 2007


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 gert.driesen at pandora.be.

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

--- shadow/81037	2007-03-05 07:29:11.000000000 -0500
+++ shadow/81037.tmp.22528	2007-03-05 07:29:11.000000000 -0500
@@ -0,0 +1,65 @@
+Bug#: 81037
+Product: Mono: Runtime
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Type.Equals does not return true if UnderlyingSystemType matches
+
+Apparently, Mono's Type.Equals does not return true if the 
+UnderlyingSystemType of the compared types matches.
+
+To reproduce, compile and run the attached code snippet:
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+public class Test
+{
+  static int Main (string [] args)
+  {
+    AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
+    TypeAttributes attribs = TypeAttributes.Public;
+
+    AssemblyName name = new AssemblyName ();
+    name.Name = "enumtest";
+    AssemblyBuilder assembly = 
+AppDomain.CurrentDomain.DefineDynamicAssembly (
+			name, access);
+
+    ModuleBuilder module = assembly.DefineDynamicModule 
+("m", "enumtest.dll");
+    EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
+
+    Console.WriteLine ("UnderlyingSystemType 1: " + typeof 
+(int).UnderlyingSystemType);
+    Console.WriteLine ("UnderlyingSystemType 2: " + 
+e.UnderlyingSystemType);
+    bool equal = typeof (int).Equals (e);
+    Console.WriteLine (equal);
+    return equal ? 0 : 1;
+  }
+}
+
+Expected result:
+
+UnderlyingSystemType 1: System.Int32
+UnderlyingSystemType 2: System.Int32
+True
+
+Actual result:
+
+UnderlyingSystemType 1: System.Int32
+UnderlyingSystemType 2: System.Int32
+False


More information about the mono-bugs mailing list