Bugzilla – Bug 312672
methods w/ "params" in interfaces being called from a dll
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by aherscovici@empirix.com 2003-07-31 13:44:53 MST ---- 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 ---- Additional Comments From ravi@ximian.com 2003-08-01 14:01:44 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO47030 *** This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"