Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

VS 2010: IDispatch::Invoke fails with DISP_E_BADCALLEE when called on Addin Instance object passed to OnConnection.

$
0
0

Hi!

I'm trying to implement a simple C++ abstraction for a generic IDTExtensibility2-based addin with an option of supporting VisualStudio' family IDTCommandTarget interface.

In order to support both addins: for MS Office and VisualStudio, I prefer to use late binding and get the value of AddInInst.ProgID property via IDispatch.

This technique works perfectly in VS 7.1, VS 9.0 (I suppose, in VS 8.0 too), but fails with VS 10.0.

In the following snippet:

 

if (S_OK == instance->Invoke(3 /*get_ProgID*/, IID_NULL, 0, DISPATCH_PROPERTYGET, &dispparams, &vregid, NULL, &arg_error))
	_regid = _bstr_t(vregid);

Invoke returns DISP_E_BADCALLEE. Calling the same method using metadata object (ITypeInfo, got from the same 'instance') and passing 'instance' variable as 'pvInstance' according to http://msdn.microsoft.com/en-us/library/aa911675.aspx did help. Stepping into the assembly of IDispatch::Invoke method revealed that ATL thunks are used in the implementation, so that ITypeInfo::Invoke is being called with pvInstance decreased by 0x14, which, obviously, leads to a failed (misrouted) call.

The implementation of IDispatch::Invoke resides inside '%Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\msenv.dll' library.

This behavior looks pretty much as a defect to me, so my question:

Is this is a known defect and/or is it scheduled for a fix?

 

Thank you,

Artem Gevorkyan

 


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>