[Mono-bugs] [Bug 520018] New: Type.GetField(string, BindingFlags) appears to ignore base classes when looking for fields, regardless of the BindingFlags argument passed in.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 7 20:19:05 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=520018


           Summary: Type.GetField(string, BindingFlags) appears to ignore
                    base classes when looking for fields, regardless of
                    the BindingFlags argument passed in.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: steve at smartz.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;
Trident/4.0; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; .NET CLR 3.0.04506.648; InfoPath.2; .NET CLR 3.5.21022; .NET CLR
3.5.30428; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3;
OfficeLivePatch.0.0)

In our product, I need to set a page's form using reflection.

Under .NET, I use the following code:

public static void SetRequest(Page page, HttpRequest request)
  {
    // Set the page's form through reflection.
    Type type = page.GetType();
    FieldInfo field = type.GetField("_request", BindingFlags.NonPublic |
BindingFlags.Instance);
    field.SetValue(page, request);
  }

This works fine under .NET.  Under Mono, the "_request" field is not found and
returned.

To debug, I tried using GetFields() to retrieve a list of all fields, printing
out the details of all items returned.  Under .Net, all fields, including those
of base classes are returned.  Under Mono, only the fields that are directly in
the Type returned from page.GetType()are returned.




Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list