[Mono-bugs] [Bug 49346][Nor] New - Attributes on interface properties are lost

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 2 Feb 2004 17:28:28 -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 ravi@ximian.com.

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

--- shadow/49346	2004-02-02 17:28:28.000000000 -0500
+++ shadow/49346.tmp.24379	2004-02-02 17:28:28.000000000 -0500
@@ -0,0 +1,70 @@
+Bug#: 49346
+Product: Mono/Compilers
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: ravi@ximian.com                            
+ReportedBy: lmaloney@bigpond.net.au               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Attributes on interface properties are lost
+
+Description of Problem:
+Attributes for interface properties disappear.
+
+Steps to reproduce the problem:
+using System;
+using System.Reflection;
+using System.ComponentModel;
+
+public class AttrTest
+{
+	public static void Main()
+	{
+		MemberInfo TestMemberInfo = typeof(ITest).GetMethod("get_TestAttribute");
+
+		DescriptionAttribute DescAttr =
+(DescriptionAttribute)Attribute.GetCustomAttribute(TestMemberInfo,
+typeof(DescriptionAttribute));
+		Console.WriteLine(DescAttr.Description);
+
+	}
+}
+
+public interface ITest
+{
+	string TestAttribute
+	{
+		[Description("This attribute disappears")] get;
+	}
+}
+
+Actual Results:
+NullReferenceException at DescATtr.Description because GetCustomAttribute
+returned null.
+
+Expected Results:
+Under Windows/.NET this displays the string "This attribute disappears".
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+This seems to only happen with properties, not methods.
+DescriptionAttribute was only used as an example.  It appears to happen
+with any attribute.
+Running 'strings' on the binary shows that the value is not being stored.
+
+------- Additional Comments From ravi@ximian.com  2003-10-06 11:27 -------
+Assigning to myself
+
+------- Additional Comments From ravi@ximian.com  2004-02-02 17:28 -------
+This has been fixed.