views:

26

answers:

1

I have a .NET (3.5 w/ Dev Studio 2008) app that hosts a visual Active X (written in C++ w/ Dev Studio 2003). Have access to all sources, but can't easily move the Active X control up to 2008.

This as worked fine in the past. Made some changes to the Active X control and now, when calling one method on the Active X, I'm getting a TargetParameterCountException 100% of the time. The signature of the Active X method is:

LONG CMyActive::License(LPCTSTR string1, LPCTSTR string2, LONG long1, LPCTSTR string3, LPCTSTR string4);

When viewing the method in object browser of reflector, .NET sees it as:

public virtual int License(string string1, string string2, int long1, string string3, string string4)

I renamed the parameters for demonstration purpose (boss gets twitchy about any code). I left the method name, as it could be relevant.

There are method calls prior that work. I just can't seen to figure out why I'm all of a sudden getting this exception. The HRESULT is 0x8002000e and a quick search seems to indicate that's a general one.

Thanks to all for reading.

Edit

Thanks for the pointers. There is some comfort in knowing others are perplexed. What is odd, is that this did work. This behavior cropped up after a rebuild of the Active X. No interface or other IDL changes. And it's on multiple machines, not just limited to one dev box or such.

Edit 2

For S&G's I added a new method,

LONG CMyActive::XXXLicense(LPCTSTR string1, LPCTSTR string2, LONG long1, LPCTSTR string3, LPCTSTR string4);

Rebuilt everything and now I can call the new method... This smells like a bug either in the compiler and/or the COM interoperability layer of .NET.

A: 

The HRESULT is DISP_E_BADPARAMCOUNT (better for googling than "0x8002000e").

Seems other people have bumped into this problem:

http://www.codeguru.com/forum/showthread.php?t=96353

http://forums.devx.com/showthread.php?t=85215

MusiGenesis