[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:46:48 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 nazgul at omega.pl.


--- shadow/82625	2007-08-29 13:28:09.000000000 -0400
+++ shadow/82625.tmp.3430	2007-08-29 13:46:48.000000000 -0400
@@ -166,6 +166,29 @@
 		foreach (object o in _tb.GetFields ())
 			Console.WriteLine (o);
+------- Additional Comments From nazgul at omega.pl  2007-08-29 13:46 -------
+Yes, unfortunately this is not feasible in a complex compilation
+contexts, where you need to fetch available fields for the purpose of
+emitting IL with references to them. This the case especially when you
+need to create references to instantiated versions of current type,
+like e.g.
+class A<T> {
+  T x;
+  void foo () { 
+    A<int> y = new A<int> ();
+    y.x = 2;  
+  }
+This code requires you to call MakeGenericType on TypeBuilder (before
+calling CreateType) and then using GetFields to find appropriate
+FieldInfo relating to A<int>.x
+I'm not sure how it is done in gmcs, but once upon a time we worked
+hard to make this run on both Mono and MS.NET. It would be really
+great to bring back the old functionality.

More information about the mono-bugs mailing list