Hi all,

Still trying get NAnt works under mono and found this bug completely breaks NAnt core:

Static method Attribute.GetCustomAttribute(from,type) queries whether something has or 
not attributte of such type. MS doc says (after very long study) that it returns 
"attribute which is assignable to this type". That means - not only attributes of this 
type, but also derived attributes.

There is example (this should be tested on MS .net, but I do not have one available)
------
using System;
using System.Reflection;

class Test
{
        string _test = "ahoj";

        class BaseAttribute : Attribute
        {
        }

        class DerivedAttribute : BaseAttribute
        {
        }

        [DerivedAttribute]
        public string TestProp { get{ return _test;} }

        static public void Main()
        {
                Test t=new Test();
                PropertyInfo 
p=t.GetType().GetProperty("TestProp",BindingFlags.Public|BindingFlags.Instance);
                Console.WriteLine(p);

                object[] ats;
                object at=Attribute.GetCustomAttribute(p,typeof(BaseAttribute));
                Console.WriteLine(at);

                ats=p.GetCustomAttributes(true);
                foreach(object a in ats) {
                        Console.WriteLine(a);
                }
        }

}
------

Martin


______________________________________________________________________________
SB KOMPLETŽ  Informační ekonomický systém http://www.sb-komplet.cz  
�umíme svoji práci!


_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to