[Mono-bugs] [Bug 82625][Nor] Changed - Crash in System.MonoType.GetFields_internal
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Aug 29 13:28:09 EDT 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 vargaz at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=82625
--- shadow/82625 2007-08-29 12:56:25.000000000 -0400
+++ shadow/82625.tmp.3237 2007-08-29 13:28:09.000000000 -0400
@@ -129,6 +129,43 @@
of TypeBuilders on MS.NET (using reflection and accessing private
fields of TypeBuilder), but used the "normal" path on Mono since it
worked fine. The workaround is not enabled when running on Mono, so
this is probably why it works on MS.NET and not on Mono.
+
+------- Additional Comments From vargaz at gmail.com 2007-08-29 13:28 -------
+A possible workaround is calling GetFields () on the Type returned by
+TypeBuilder.CreateType ().
+
+A minimal testcase:
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class Tests {
+
+ public static void Main () {
+ AssemblyName assemblyName = new AssemblyName ();
+ assemblyName.Name = "MonoTests.System.Reflection.Emit.FieldBuilderTest";
+
+ AssemblyBuilder assembly = Thread.GetDomain ().DefineDynamicAssembly (
+ assemblyName, AssemblyBuilderAccess.Run);
+
+ ModuleBuilder module = assembly.DefineDynamicModule ("module1");
+ TypeBuilder _tb = module.DefineType ("type1", TypeAttributes.Public);
+
+ FieldBuilder field = _tb.DefineField ("name",
+ typeof(string), FieldAttributes.Public);
+
+ GenericTypeParameterBuilder[] pars = _tb.DefineGenericParameters
+(new String [] { "par1", "par2" });
+
+ _tb.CreateType ();
+
+ foreach (object o in _tb.GetFields ())
+ Console.WriteLine (o);
+ }
+}
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
More information about the mono-bugs
mailing list