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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=75366 --- shadow/75366 2005-07-01 04:47:50.000000000 -0400 +++ shadow/75366.tmp.12414 2005-07-01 04:56:40.000000000 -0400 @@ -169,6 +169,44 @@ ------- Additional Comments From [EMAIL PROTECTED] 2005-07-01 04:47 ------- The patch is a clear no-go - this code is there for a reason. It's not worth spending a week rewriting the whole generics code for this as there's an easy workaround (use Type.GetMembers() on the "correct" type, like mcs/gmcs does), so let's close this as WONTFIX. + +------- Additional Comments From [EMAIL PROTECTED] 2005-07-01 04:56 ------- +Ben, to answer your question, in a `MonoReflectionField *f', +`f->klass' is a generic type definition if the field is in a generic +type and `f->field->parent' is a generic instance. + +So in + +==== +class Foo <T> +{ + public T foo; +} + +class X +{ + static void Main () + { + Foo<int> foo = new Foo<int>; + Console.WriteLine (foo.foo); + } +} +==== + +these two become different - we have to encode the field as + + ldfld !0 class [J]A`1<int32>::foo + +Unfortunately, the only way for GMCS to tell reflection to do that +is doing something like + + Type t = Type.GetType ("A`1<int>"); + MemberInfo[] mi = t.GetMembers ("foo", MemberTypes.Field); + FieldInfo fi = (FieldInfo) mi [0]; + +This returns a FieldInfo who's `DeclaringType` is the generic type +definition `A<T>' and who's `ReflectedType' is the generic instance +`A<int>'. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
