| Previous | Next |
| RO_E_METADATA_INVALID_TYPE_FORMAT | RO_E_CLOSED |
RO_E_INVALID_METADATA_FILE
Windows Runtime metadata file is invalid or corrupted
RO_E_INVALID_METADATA_FILE is HRESULT 2147483666 (0x80000012) from winerror.h. AllStat describes it as “Metadata file is invalid or corrupted.” In the Windows Runtime metadata, object lifetime, asynchronous operation, activation, and apartment model, the code identifies a specific failure boundary and should not be replaced by a generic COM exception.
The caller should keep this result intact through logging, exception translation, and RPC or language projection boundaries.
Where it is encountered
- C++/WinRT, WRL,.NET projections, or native WinRT ABI calls. Record the interface, method, component version, thread, apartment, process, and correlation ID.
- 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 for it is a WinMD file whose PE/CLI metadata structures, signatures, tables, or WinRT restrictions cannot be parsed or validated. Keep it attached to that operation; the same numeric severity outside the owning API does not supply enough context.
Decisive interpretation boundary
Before choosing recovery, verify that the exact file, package identity, hash, architecture, and producer toolchain are known and the failure reproduces outside the consuming application. The decisive boundary for it determines whether the same object can continue, a new object is required, or policy must change.
Also confirm that all observed objects, tokens, buffers, proxies, metadata files, or ACLs belong to the current operation generation and were not retained from an earlier attempt.
Correct handling and recovery
Replace the damaged or incompatible WinMD from a trusted package, repair the build pipeline, and regenerate projections. Never continue using partially parsed metadata.
Repeat the operation after it only when the documented precondition, identity, apartment, object generation, buffer, or configuration has changed.
Lifetime, retry, and cleanup rules
After it, determine whether the current object, interface pointer, call context, token, stream, metadata reader, asynchronous operation, or access-control instance remains valid. Release only resources owned by the failing attempt, cancel callbacks through their documented mechanism, and avoid double close, double commit, repeated activation, or replay of a non-idempotent remote method.
The retry policy for it should state the trigger, maximum attempts, cancellation owner, and reconciliation step for effects that may have completed elsewhere.
Difference from nearby HRESULTs
It faults the metadata container; name-related RO errors assume the file was readable enough to perform symbol lookup.
A support tool discussing it should name the neighboring result only after the originating API and decisive state are known.
Practical scenario
A deployment contains a zero-truncated WinMD after an interrupted copy. Package repair restores the signed file and activation succeeds with the same type name.
A regression test should reproduce it, assert the raw HRESULT and all relevant outputs, then correct only the decisive condition and verify the intended success or neighboring failure result.
References
- Microsoft: C++/WinRT error handling
- Microsoft: concurrency and asynchronous operations
- Microsoft: WinMD files
- Microsoft: IAgileObject
- Microsoft: COM apartments
- Microsoft: HRESULT values
Looking for a different code? Search another status or error code.