[Mono-devel-list] Regression: Attribute.GetCustomAttribute no longer returns attributes from base classes
Gert Driesen
gert.driesen at pandora.be
Sun Feb 22 07:50:26 EST 2004
Hi,
There's a serious regression in Mono (built from cvs) with regards to
custom attributes.
The Attribute.GetCustomAttribute method no longer returns a custom
attribute that was assigned to a property of a base class, when invoke on a
derived class.
For example, when you have the following classes :
public class DerivedDecoratedClass : DecoratedClass {
}
public class DecoratedClass {
private string _dunno;
[TestAttribute("test")]
public string Dunno {
get { return _dunno; }
set { _dunno = value; }
}
}
then
Attribute.GetCustomAttribute(property, typeof(TestAttribute)) for the Dunno
property of the DerivedDecoratedClass will return null, while this should
not.
This used to work fine in Mono 0.30, and still works as expected in MS.NET.
I attached a test case for this issue, which yields the following on Mono
0.30 and MS.NET :
Checking attribute on 'AttributeIssue.DecoratedClass'.
Dunno property: Attribute found
Checking attribute on 'AttributeIssue.DerivedDecoratedClass'.
Dunno property: Attribute found
but on Mono built from cvs, the result is :
Checking attribute on 'AttributeIssue.DecoratedClass'.
Dunno property: Attribute found
Checking attribute on 'AttributeIssue.DerivedDecoratedClass'.
Dunno property: Attribute not found!
as you'll see, Mono does not seem to be able to return the attribute on
the derived class.
Because of this issue NAnt is no longer functional on Mono/Linux, so I
filed a bug report on this in bugzilla (#54716,
http://bugzilla.ximian.com/show_bug.cgi?id=54716).
Gert
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040222/dc69def2/attachment.pl
More information about the Mono-devel-list
mailing list