[Mono-bugs] [Bug 61224][Nor] New - System.Type.GetNestedTypes does not work with dynamically emitted types
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 6 Jul 2004 20:51:06 -0400 (EDT)
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 rbo@acm.org.
http://bugzilla.ximian.com/show_bug.cgi?id=61224
--- shadow/61224 2004-07-06 20:51:06.000000000 -0400
+++ shadow/61224.tmp.20802 2004-07-06 20:51:06.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 61224
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: rbo@acm.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Type.GetNestedTypes does not work with dynamically emitted types
+
+Steps to reproduce the problem:
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using NUnit.Framework;
+
+namespace MonoTestFixtures
+{
+ [TestFixture]
+ public class EmitNestedTypesTest
+ {
+ [Test]
+ public void TestNestedType()
+ {
+ AssemblyName name = new AssemblyName();
+ name.Name = "DynamicAssemblyWithNestedTypes";
+
+ AssemblyBuilder assemblyBuilder =
+AppDomain.CurrentDomain.DefineDynamicAssembly(name,AssemblyBuilderAccess.Run);
+
+ ModuleBuilder moduleBuilder =
+assemblyBuilder.DefineDynamicModule("DynamicModuleWithNestedTypes");
+
+ TypeBuilder outerBuilder = moduleBuilder.DefineType("Outer",
+TypeAttributes.Public);
+ TypeBuilder innerBuilder = outerBuilder.DefineNestedType("Inner",
+TypeAttributes.NestedPublic);
+
+ Type outerType = outerBuilder.CreateType();
+ Type innerType = innerBuilder.CreateType();
+
+ Assert.IsNotNull(outerType);
+ Assert.IsNotNull(outerType.GetNestedTypes());
+ Assert.AreEqual(1, outerType.GetNestedTypes().Length);
+ Assert.AreSame(innerType, outerType.GetNestedTypes()[0]);
+ }
+ }
+}
+
+Actual Results:
+Test fails.
+
+Expected Results:
+Test succeeded.
+
+How often does this happen?
+Always.
+
+Additional Information:
+The test succeeds on ms.net.