I am trying to instantiate and call methods on a .net object created from a dll from coldfusion. This works when I call methods with one or zero arguments but fails with -
System.MissingMethodException: Could not find the generic method coldfusion2net.test.setvars
when I try to call a method with more than one arg.
Here is my simple C# class:
namespace coldfusion2net
{
public class test
{
protected string myvar;
protected string myvar2;
public void setvars(string v, string v2) {
myvar = v;
myvar2 = v2;
}
public void setvar(string v) {
myvar = v;
}
public string getvar(){
return myvar;
}
}
}
and here is my ColdFusion test:
<cfset dll = ExpandPath('./coldfusion2net.dll')>
<cfobject type=".NET" name="test" class="coldfusion2net.test" assembly="#dll#">
<cfset test.init()>
<!--- object has been loaded --->
<cfdump var="#test#">
<!--- so far so good --->
<cfset test.setvar("foo")>
<cfset s = test.getvar()>
<cfoutput>#s#</cfoutput>
<!--- wtf??? --->
<cfset test.setvars("foo","bar")>
To compile the dll, I am using visual studio 2010 targeting the .net 3.5 runtime (which is what we have on our servers). I am using ColdFusion 8,0,0,176276 to try and load the dll.
Has anyone else seen anything like this? Am I doing something wrong? Is this a CF bug?
I looked in the article on the Adobe live docs on .NET Interoperability Limitations but the closest thing I found is "ColdFusion cannot determine the correct data type conversion if a method has multiple signatures that have the same number of parameters and differ only in the parameter data types". This does not seem to be the problem here.
#test#
object. Do you see the setVars() method? – Amujavacast("string","foo")
? – Compressibility