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


           Summary: GetMethod fails to find private methods up the class
                    hierarchy when using BindingFlags.NonPublic
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i386
        OS/Version: Mac
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: Customer


GetMethod does not look for methods in base classes if the method is private
and you are using BindingFlags.NonPublic.


------
using System.Reflection;

class Test
{
        class TestInheritedMethodA
        {
            private void TestMethod()
            {

            }

            public void TestMethod2()
            {

            }
        }

        class TestInheritedMethodB : TestInheritedMethodA
        {

        }

        public static void Main ()
        {
            MethodInfo inheritedMethod =
typeof(TestInheritedMethodB).GetMethod("TestMethod", BindingFlags.Instance |
BindingFlags.Public | BindingFlags.NonPublic);
            MethodInfo baseMethod =
typeof(TestInheritedMethodB).GetMethod("TestMethod", BindingFlags.Instance |
BindingFlags.Public | BindingFlags.NonPublic);
            if (inheritedMethod != baseMethod)
                System.Console.WriteLine("Bug1");
        }
}



Running this script will print bug1, because inheritedMethod returns null. 
inheritedMethod should equal baseMethod

-- 
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to