| Previous | Next |
| RPC_E_CANTCALLOUT_ININPUTSYNCCALL | RPC_E_THREAD_NOT_INIT |
RPC_E_WRONG_THREAD
COM interface was used from the wrong thread
RPC_E_WRONG_THREAD is HRESULT 2147549454 (0x8001010E) from winerror.h. The documented description is “The application called an interface that was marshalled for a different thread.” The relevant context is the COM/RPC call control, message filtering, apartment routing, marshaling, security negotiation, or remote object lifetime.
Where it is encountered
- Cross-apartment or cross-process COM method invocation and activation.
- STA message filtering, reentrancy, call cancellation, timeout, or retry handling.
- DCOM security initialization, proxy/stub marshaling, OBJREF processing, and server object lifetime.
The immediate focus is an apartment-bound interface pointer invoked from a thread or apartment other than the one for which it was marshaled.
What to verify
Verify that originating thread, current thread, apartment model, marshaling mechanism, and object agility are known.
Correct handling and recovery
Marshal the interface, use an agile reference when supported, or dispatch the call to the owning apartment. Never share a raw apartment-bound pointer globally.
Difference from nearby HRESULTs
It concerns use of an existing interface; RO_E_UNSUPPORTED_FROM_MTA concerns activation of an STA-only class from the MTA.
Practical scenario
A worker thread calls a UI COM object captured on the main STA. The code marshals the interface or posts work to the UI dispatcher.
References
Looking for a different code? Search another status or error code.