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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 5 Oct 2003 06:27:04 -0400 (EDT)


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 lmaloney@bigpond.net.au.

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

--- shadow/49346	2003-10-05 06:27:04.000000000 -0400
+++ shadow/49346.tmp.19385	2003-10-05 06:27:04.000000000 -0400
@@ -0,0 +1,64 @@
+Bug#: 49346
+Product: Mono/MCS
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@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.