[Mono-bugs] [Bug 47187][Nor] New - methods w/ "params" in interfaces being called from a dll
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Thu, 31 Jul 2003 13:44:53 -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 aherscovici@empirix.com.
http://bugzilla.ximian.com/show_bug.cgi?id=47187
--- shadow/47187 Thu Jul 31 13:44:53 2003
+++ shadow/47187.tmp.20795 Thu Jul 31 13:44:53 2003
@@ -0,0 +1,78 @@
+Bug#: 47187
+Product: Mono/MCS
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: aherscovici@empirix.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: methods w/ "params" in interfaces being called from a dll
+
+When you make an interface with a method that has "params object[] foo" in
+the parameter list, compile it to a dll then implement it in another
+place, the "params" keyword gets ignored! Here is an example I used to
+reproduce this (if the interface exists in the same dll as its
+implementation or at least the same file, this works fine):
+
+
+// FIRST FILE (compile after you have compiled the dll with the second
+file)
+
+using System;
+
+namespace foo {
+
+using bar;
+
+public class A {
+
+static void Main () {
+
+string moo = "moo";
+C t = new B();
+B s = new B();
+
+t.test(3,moo);
+t.test(3);
+s.test(3,moo);
+s.test(3);
+}
+}
+
+public class B:C {
+public void test (int c,params object[] args) {
+Console.WriteLine(c);
+}
+}
+}
+
+// SECOND FILE (compile this to a DLL)
+
+namespace bar {
+
+public interface C {
+
+void test (int c, params object[] args);
+
+}
+}
+
+// ERROR!
+file1.cs(18) error CS1503: Argument 1: Cannot convert from 'string'
+to 'object[]'
+file1.cs(18) error CS1501: No overload for method `test' takes `2'
+arguments
+file1.cs(18) error CS8006: Could not find any applicable function for this
+argument list
+file1.cs(19) error CS1501: No overload for method `test' takes `1'
+arguments
+file1.cs(19) error CS8006: Could not find any applicable function for this
+argument list