[Mono-bugs] [Bug 75968][Nor] New - [PATCH] allow string array for attribute parameter type

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Sep 2 10:52:12 EDT 2005


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 atsushi at ximian.com.

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

--- shadow/75968	2005-09-02 10:52:12.000000000 -0400
+++ shadow/75968.tmp.12077	2005-09-02 10:52:12.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 75968
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] allow string array for attribute parameter type
+
+Currently mcs does not allow string array type as a parameter type, while
+it is allowed:
+
+<blockquote>
+24.1.3 Attribute parameter types
+The types of positional and named parameters for an attribute class are
+limited to the attribute parameter
+types, which are:
+• One of the following types: bool, byte, char, double, float, int, long,
+short, string.
+• The type object.
+• The type System.Type.
+• An enum type, provided it has public accessibility and the types in which
+it is nested (if any) also have
+public accessibility.
+• Single-dimensional arrays of the above types.
+</blockquote>
+
+---- repro ----
+using System;
+
+class FooAttribute : Attribute
+{
+        public string [] Values;
+
+        public FooAttribute ()
+        {
+        }
+}
+
+[Foo (Values = new string [] {"foo", "bar", "baz"})]
+class Test
+{
+        public static void Main () {}
+}
+--------
+
+
+Actual Results:
+
+test-453.cs(13,2): error CS0655: `Values' is not a valid named attribute
+argument because it is not a valid attribute parameter type.
+
+Expected Results:
+
+Compiles successfully.
+
+Attaching a fix.


More information about the mono-bugs mailing list