| Previous | Next |
| E_APPLICATION_VIEW_EXITING | RO_E_UNSUPPORTED_FROM_MTA |
RO_E_MUST_BE_AGILE
Object must be agile across apartments
RO_E_MUST_BE_AGILE is HRESULT 2147483676 (0x8000001C) from winerror.h. The documented description is “The object must support the IAgileObject interface.” The relevant context is the Windows Runtime metadata, object lifetime, asynchronous operation, activation, and apartment model.
The hexadecimal value and symbolic name of this result should remain attached to the originating API and operation instance.
What to verify
Verify that the object agility, marshaling behavior, originating apartment, destination apartment, and lifetime requirements are verified.
Where it is encountered
- C++/WinRT, WRL, .NET projections, or native WinRT ABI calls.
- Runtime-class activation, WinMD reflection, asynchronous objects, observable state, or view lifecycle.
- Cross-thread and cross-apartment handoff between UI, ASTA, STA, MTA, broker, and background work.
The immediate focus is a WinRT or COM object crossing apartment or thread boundaries where the receiving contract requires IAgileObject support or an agile reference.
Correct handling and recovery
Use an agile implementation, create an agile reference, marshal through a supported proxy, or keep access on the originating apartment. Do not pass raw interface pointers across threads.
Difference from nearby HRESULTs
It is about cross-apartment capability; RPC_E_WRONG_THREAD reports use of an interface from a thread that does not own its marshaled context.
Practical scenario
A background task captures a UI-bound runtime object in a lambda. The code captures an agile data snapshot instead and dispatches UI work back to the owning apartment.
References
Looking for a different code? Search another status or error code.