[Mono-bugs] [Bug 54716][Blo] New - Regression: Attribute.GetCustomAttribute no longer returns attributes from base classes
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 22 Feb 2004 05:02:38 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by gert.driesen@pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=54716
--- shadow/54716 2004-02-22 05:02:38.000000000 -0500
+++ shadow/54716.tmp.9651 2004-02-22 05:02:38.000000000 -0500
@@ -0,0 +1,66 @@
+Bug#: 54716
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details: Gentoo Linux 1.4
+Status: NEW
+Resolution:
+Severity:
+Priority: Blocker
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gert.driesen@pandora.be
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Regression: Attribute.GetCustomAttribute no longer returns attributes from base classes
+
+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'll attach 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 can see, Mono does not seem to be able to return the attribute on
+the derived class.