[Mono-bugs] [Bug 70102][Wis] New - Attribute constructor with params keyword causes compiler exception

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 1 Dec 2004 14:25:24 -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 xfurious@gmail.com.

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

--- shadow/70102	2004-12-01 14:25:24.000000000 -0500
+++ shadow/70102.tmp.15847	2004-12-01 14:25:24.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 70102
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: xfurious@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Attribute constructor with params keyword causes compiler exception
+
+Description of Problem: 
+Custom attributes which have constructors such as: 
+RequestAttribute(string req, string ret, params string[] maps); 
+Cause a compiler exception when mcs hits this: 
+ 
+[Request("somereq", "result")] 
+int SomeRequest(); 
+ 
+When the attribute is constructed with [Request("somereq", "result", "a", 
+"b")], the application compiles and runs properly. 
+ 
+Steps to reproduce the problem: 
+1. Attempt to compile this code:  
+using System; 
+ 
+public class RequestAttribute: Attribute { 
+	public RequestAttribute(string a, string b, params string[] c) 
+	{ 
+	 
+	} 
+} 
+ 
+public class MyClass { 
+	[Request("somereq", "result")] 
+	public int SomeRequest() 
+	{ 
+		return 0; 
+	} 
+	 
+	public static void Main() 
+	{ 
+		SomeRequest(); 
+	} 
+} 
+ 
+ 
+Actual Results: 
+Compiler throws IndexOutOfRangeException with stack 
+in <0x0137f> Mono.CSharp.Attribute:Resolve (Mono.CSharp.EmitContext) 
+in <0x0004c> Mono.CSharp.Attribute:Emit (Mono.CSharp.EmitContext,Mono.
+CSharp.Attributable,System.Collections.Specialized.ListDictionary) 
+in <0x000c3> Mono.CSharp.Attributes:Emit (Mono.CSharp.EmitContext,Mono.
+CSharp.Attributable) 
+in <0x000e1> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer,Mono.
+CSharp.Attributable) 
+in <0x00016> Mono.CSharp.Method:Emit (Mono.CSharp.TypeContainer) 
+in <0x00648> Mono.CSharp.TypeContainer:Emit () 
+in <0x0088c> Mono.CSharp.RootContext:EmitCode () 
+in <0x00c4b> Mono.CSharp.Driver:MainDriver (string[]) 
+in <0x00018> Mono.CSharp.Driver:Main (string[]) 
+ 
+Expected Results: 
+Compile succeeds 
+ 
+How often does this happen?  
+Always 
+ 
+Additional Information: 
+Doesn't seem to happen for normal constructors 
+mcs --version: 
+Mono C# compiler version 1.0.0.0