[Mono-bugs] [Bug 662867] New: Attribute.GetCustomAttributes fails in searching inheritance chain against overridden method ToString()

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 6 18:21:14 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=662867

https://bugzilla.novell.com/show_bug.cgi?id=662867#c0


           Summary: Attribute.GetCustomAttributes fails in searching
                    inheritance chain against overridden method ToString()
    Classification: Mono
           Product: MonoTouch
           Version: unspecified
          Platform: Macintosh
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkozak at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:

ttribute.GetCustomAttributes fails in searching inheritance chain against
overridden method ToString()


Steps to reproduce the problem:
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
    public class CAttr : Attribute
    {
        public CAttr ()
        {
        }
    }

    class One
    {
        [CAttr]
        public override string ToString ()
        {
            return null;
        }
    }

    class Two : One
    {
    }
    class Three : Two
    {
    }
    class Four : Three
    {
    }
    class Five : Four
    {
        public override string ToString ()
        {
             return null;
        }
    }

    class Driver
    {
        static void Main (string[] args)
        {
            var attrs = Attribute.GetCustomAttributes (typeof(Five).GetMethod
("ToString"), true);
            Console.WriteLine (attrs[0]);
        }
    }


Actual Results:
attrs is null

Expected Results:
attrs should have one attribute in array 

How often does this happen? 
always

Additional Information:

-- 
Configure bugmail: https://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