[Mono-bugs] [Bug 60219][Blo] Changed - C# compiler throws InternalErrorException in ConstructorInitializer:GetOverloadedConstructor
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 17 Jun 2004 18:12:36 -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 patrick@kinitos.com.
http://bugzilla.ximian.com/show_bug.cgi?id=60219
--- shadow/60219 2004-06-15 15:43:24.000000000 -0400
+++ shadow/60219.tmp.19276 2004-06-17 18:12:36.000000000 -0400
@@ -65,6 +65,51 @@
make it work.
------- Additional Comments From miguel@ximian.com 2004-06-15 15:43 -------
Fixed on CVS.
Marek, can you check if my fix is correct?
+
+------- Additional Comments From patrick@kinitos.com 2004-06-17 18:12 -------
+I continue to have problems with this.
+I got and built the latest copy of mcs (and mono) from anon-cvs today
+and it stils exhibits this problem. So I took a look at the code to
+see what was happening. If you look at mcs/class.cs,
+Mono.CSharp.ConstructorInitializer:GetOverloadedConstructor function,
+you can see the first thing in the foreach loop is a check if the
+caller has any arguments. If they are not we will only return a
+constructors that has a zero length arguement list. However the other
+option should be to take a constructor with one parameter that has
+the "params" modifier.
+
+I have made and tested the following change to the if(Arguments ==
+null) block, (currently on line 3246);
+if (Arguments == null) {
+ if (c.ParameterTypes.Length == 0
+ || (c.ParameterInfo.Count == 1
+ && c.ParameterInfo.ParameterModifier (0) ==
+Parameter.Modifier.PARAMS))
+ return c;
+
+ continue;
+}
+
+I have tested this with the following code and it now works;
+public class MyClass {
+ public MyClass( params System.String [] parameters )
+ {
+ System.Console.WriteLine(parameters.Length + "\n");
+ }
+}
+
+public class ChildClass : MyClass {}
+
+public class test
+{
+ static void Main ()
+ {
+ ChildClass c = new ChildClass();
+ }
+}
+
+Let me know if this is useful, or if i have the wrong version of the
+code from CVS. Thanks Patrick