Why does ICorDebug::SetManagedHandler() return E_NOINTERFACE?
Since I have no energy to type a long post today (sigh), I'll spare you the gory details on the cause of this error. Here are the main reasons why you would be seeing this error -
- While expecting to debug a v2.0.xxxx managed app, you have forgotten to implement ICorDebugManagedCallback2 in your managed callback handler. The managed callback handler must implement both ICorDebugManagedCallback and ICorDebugManagedCallback2 in such cases.
class ManagedEngine : public ICorDebugManagedCallback, public ICorDebugManagedCallback2
- While implementing QueryInterace(..), you probably forgot to account for ICorDebugManagedCallback2.
HRESULT __stdcall ManagedEngine::QueryInterface(const IID & iid, void** ppv)
if (iid == IID_IUnknown)
* ppv = static_cast<ICorDebugManagedCallback*>(this); // original implementation
else if (iid == IID_ICorDebugManagedCallback)
* ppv = static_cast<ICorDebugManagedCallback*>(this);
else if (iid == IID_ICorDebugManagedCallback2)
* ppv = static_cast<ICorDebugManagedCallback2*>(this);
* ppv = NULL;