[Mono-bugs] [Bug 81797][Nor] New - Attribute.GetCustomAttributes doesn't get inherited attributes for properties

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jun 1 13:24:09 EDT 2007


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 rolfkvinge at ya.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81797

--- shadow/81797	2007-06-01 13:24:09.000000000 -0400
+++ shadow/81797.tmp.11599	2007-06-01 13:24:09.000000000 -0400
@@ -0,0 +1,64 @@
+Bug#: 81797
+Product: Mono: Class Libraries
+Version: 1.0
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: rolfkvinge at ya.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Attribute.GetCustomAttributes doesn't get inherited attributes for properties
+
+Repro:
+
+using System.Reflection;
+using System;
+using System.ComponentModel;
+
+class b 
+{
+	static void Main ()
+	{
+		Type derived = typeof (Derived);
+		PropertyInfo p = derived.GetProperty ("P");
+
+		Console.WriteLine (p.GetCustomAttributes (true).Length);
+		Console.WriteLine (Attribute.GetCustomAttributes (p, 
+true).Length);
+	}
+	class Base
+	{
+		[DesignOnly (true)]
+		[Browsable (false)]
+		[Description ("Desc")]
+		[Category ("A")]
+		public virtual string P {
+			get { return null; }
+			set { }
+		}
+	}
+
+	class Derived : Base
+	{
+		public override string P {
+			get { return null; }
+			set { }
+		}
+	}
+
+}
+
+MS prints:
+0
+4
+
+Mono prints:
+0
+0


More information about the mono-bugs mailing list