| Previous | Next |
| TYPE_E_INVALIDID | TYPE_E_OUTOFBOUNDS |
TYPE_E_TYPEMISMATCH
Type-library element has an incompatible type
TYPE_E_TYPEMISMATCH is HRESULT 2147650720 (0x80028CA0) from winerror.h. The documented description is “Type mismatch.” The result belongs to construction, import, or validation of TYPEDESC and ELEMDESC metadata. This HRESULT is most useful when tied to the method and lifecycle phase where a declared type cannot be used where the type-library operation expects another kind of type.
This result means that a declared type cannot be used where the type-library operation expects another kind of type.
Where the result appears
- This result can surface in a type-library compiler, importer, registration step, proxy generator, or Automation metadata consumer.
- Map the failure to one concrete operation among LoadTypeLib, RegisterTypeLib, ITypeInfo, ICreateTypeInfo, FUNCDESC, TYPEDESC, and imported LIBID versions.
- Preserve LIBID, type-library version, LCID, SYSKIND, TYPEKIND, GUID, MEMBERID, HREFTYPE, and the producer toolchain before releasing or replacing the object that returned this result.
An incident record must distinguish caller, runtime, provider, and backing resource while testing whether a declared type cannot be used where the type-library operation expects another kind of type.
Typical causes and interpretation
The immediate contract boundary is specific: a declared type cannot be used where the type-library operation expects another kind of type. Common cause branches include the following:
- A property accessor uses incompatible parameter or return types.
- An alias resolves to a type that the importing tool cannot coerce.
- 32-bit and 64-bit metadata were generated from inconsistent declarations.
Confirm the cause branch that explains why a declared type cannot be used where the type-library operation expects another kind of type by using call arguments, object state, metadata, device information, or provider traces.
Correct handling and recovery
The primary recovery is to make the source declaration and every imported type library agree, then rebuild all generated interop artifacts. The failure report should capture the relevant state during construction, import, or validation of TYPEDESC and ELEMDESC metadata so it is clear why a declared type cannot be used where the type-library operation expects another kind of type.
The owner of it must define idempotency, cancellation, attempt limits, and reconciliation for the failed construction, import, or validation of TYPEDESC and ELEMDESC metadata.
Practical scenario
A generated put accessor accepts a 32-bit integer while the matching get accessor returns a string alias, so the type-library builder rejects the pair.
Difference from related HRESULTs
DISP_E_TYPEMISMATCH occurs while invoking a live Automation member; it concerns the metadata contract itself
Developer and administrator guidance
Use a minimal IDL or metadata fixture that reproduces the exact graph, then validate both 32-bit and 64-bit generated artifacts.
Broad permission or compatibility changes are inappropriate unless evidence for a declared type cannot be used where the type-library operation expects another kind of type points to that layer.
References
Looking for a different code? Search another status or error code.