Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Random AccessViolationException when calling IDispatch::Invoke

$
0
0

Hello,

I have the following problem:

I have a c++ Dll accessing with COM to a .NET DLL (C#). In most of the cases, everything goes fine, but when my dll is called by some optimized code, and in release mode only, the invoke method gives AccessViolationException


CComPtr<IDispatch> dispResults = NULL;

...

hr = dispResults->GetIDsOfNames(IID_NULL, ....)

...

hr = dispResults->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparams, &varResult, &excep, &uArgErr);

When I run my application in debug mode, or in release mode with a debugger, I have no error. The error only occurs when in release mode.

How can I investigate this error ? Is there any way to make sure the object behind has not been released ?

Thanks in advance,

Romain


Viewing all articles
Browse latest Browse all 1710

Trending Articles