[Mono-bugs] [Bug 55970][Min] New - mcs reports CS0617 for an inaccessible field in custom attribute creation

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 23 Mar 2004 16:15:21 -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 vargaz@freemail.hu.

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

--- shadow/55970	2004-03-23 16:15:21.000000000 -0500
+++ shadow/55970.tmp.18705	2004-03-23 16:15:21.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 55970
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vargaz@freemail.hu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs reports CS0617 for an inaccessible field in custom attribute creation
+
+Consider the following testcase:
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+using System;
+
+[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class,
+Inherited=true)]
+public class FooAttribute : Attribute
+{
+	char[] separator2;
+		
+	public FooAttribute(string name)
+	{
+	}
+
+	public char[] Separator {
+		get {
+			return separator2;
+		}
+	}
+}
+
+[FooAttribute("shortcut",separator2=new char[]{'A'})]
+public class Tests {
+	public static void Main () {
+		FooAttribute foo = (FooAttribute)(typeof (Tests).GetCustomAttributes
+(false) [0]);
+		Console.WriteLine (foo.Separator);
+	}
+}
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+When compiling this, mcs reports:
+
+custom.cs(19) error CS0617: 'separator2' is not a valid named attribute
+argument. Named attribute arguments must be fields which are not readonly,
+static or const, or properties with a set accessor which are not static.
+
+While csc reports a CS0122.