[Mono-bugs] [Bug 500385] GetMethod fails to find private methods up the class hierarchy when using BindingFlags.NonPublic

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 12 09:20:27 EDT 2009


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

User joe at unity3d.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=500385#c6


Joachim ANTE <joe at unity3d.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joe at unity3d.com




--- Comment #6 from Joachim ANTE <joe at unity3d.com>  2009-05-12 07:20:26 MDT ---
Turns out I posted the wrong test. Doh. Sorry about that.

This should be reproducable, at least it is reproducable with the 2.4 installer
package.




using System.Reflection;

        class TestInheritedMethodA
        {
            void TestMethod()
            {

            }

            public void TestMethod2()
            {

            }
        }

        class TestInheritedMethodB : TestInheritedMethodA
        {

        }

class Test
{

        public static void Main ()
        {
            MethodInfo inheritedMethod =
typeof(TestInheritedMethodA).GetMethod("TestMethod", BindingFlags.Instance |
BindingFlags.Public | BindingFlags.NonPublic);

            MethodInfo baseMethod =
typeof(TestInheritedMethodB).GetMethod("TestMethod", BindingFlags.Instance |
BindingFlags.Public | BindingFlags.NonPublic);

            if (baseMethod == null)
                System.Console.WriteLine("BUG: base null");
            else if (inheritedMethod == null)
                System.Console.WriteLine("BUG: Inherited null");
            else if (inheritedMethod != baseMethod)
                System.Console.WriteLine("BUG: Different");
            else
                System.Console.WriteLine("Correct");
        }
}

-- 
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