What does HRESULT 0x80028CA0 (TYPE_E_TYPEMISMATCH) mean?

 
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. AllStat describes it as “Type mismatch.” The result belongs to construction, import, or validation of TYPEDESC and ELEMDESC metadata. The symbol this result is useful only 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.

The decisive meaning of this result is that a declared type cannot be used where the type-library operation expects another kind of type. The severity bit does not decide handling; the controlling fact is that a declared type cannot be used where the type-library operation expects another kind of type. A reliable it diagnosis preserves the raw value and reconstructs the state that made this true: 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 for this HRESULT 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 boundary

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 result failure report should expose enough construction, import, or validation of TYPEDESC and ELEMDESC metadata state to understand why a declared type cannot be used where the type-library operation expects another kind of type without a production debugger.

The owner of it must define idempotency, cancellation, attempt limits, and reconciliation for the failed construction, import, or validation of TYPEDESC and ELEMDESC metadata. Reconcile persistent, remote, device, or ownership state before repeating it.

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. Record the decisive state for this HRESULT and verify recovery on a fresh object or request generation.

Difference from related HRESULTs

DISP_E_TYPEMISMATCH occurs while invoking a live Automation member; it concerns the metadata contract itself Tests and telemetry should preserve that boundary for this HRESULT.

Developer and administrator guidance

Developers handling it should make object lifetime and state transitions explicit, preserve the native HRESULT, and keep cleanup paths safe when initialization or output is partial. 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. Repair for this HRESULT should target only the evidence-backed component, provider, document, device, or configuration.

References


Looking for a different code? Search another status or error code.