views:

774

answers:

1

I have a .NET assembly, written in C#. It's marked ComVisible, has a guid, is signed, regasm'd (/codebase). I did not formally define an interface for the COM part.

I use this assembly via VBscript.

There's an overloaded method - one form takes a single string argument, and the second takes two strings. Both return another .NET type from the same assembly. I call it like so:

set foo = WScript.CreateObject("Prog.Id")
' the following succeeds
set bar = foo.Method1("string")
' the following fails
set baz = foo.Method1("string1", "string2")

The first call to Method1 succeeds. The second one fails with "Wrong number of arguments or invalid property assignment".

How can I debug this?

In testing, if I define a brain-dead simple .NET class with overloads like this, I can call it from VBScript, no problem. There's something else about my "real" assembly that is causing this to fail. How do I figure out what it is?

+1  A: 

I'm not sure if this is truly the case, but it appears that COM does not allow overloading of methods: here or here

The first links seems to suggest that there may be a way around this (with an explicit interface definition and attributes perhaps?), but I doubt it.

You could also check the resulting type library with OleView.exe to see what your two methods look like to COM clients after using tlbexp on your assembly.

Andreas F
Ah, yes, I think that is the answer.
Cheeso