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


           Summary: Attribute.GetCustomAttribute not returning inherited
                    attributes
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---


In the following test case, a call to Attribute.GetCustomAttribute is failing
to return an attribute defined in a base class. It works fine in MS.NET but not
in Mono.

using System;
using System.Reflection;

class App
{
    public static void Main (string[] args)
    {
    MemberInfo m = typeof(Sub).GetProperty ("Name");
    object attr = Attribute.GetCustomAttribute (m, typeof(MyAttribute), true);
    Console.WriteLine ("Found: " + (attr != null));
    }
}

abstract class Abs
{
    public abstract string Name { get; set; }
}

class Base: Abs
{
    [MyAttribute]
    public override string Name {
        get { return ""; }
        set {}
    }
}

class Sub: Base
{
    public override string Name {
        get { return ""; }
        set {}
    }
}

class MyAttribute: Attribute
{
}

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