What does HRESULT 0x80020011 (DISP_E_NOTACOLLECTION) mean?

 
Previous Next
DISP_E_BADCALLEE DISP_E_DIVBYZERO

DISP_E_NOTACOLLECTION

Automation object does not support collection semantics

DISP_E_NOTACOLLECTION is HRESULT 2147614737 (0x80020011) from winerror.h. AllStat describes it as “Does not support a collection.” The value must be interpreted at generic Automation code attempting enumeration or indexed default-property access, because the same high-level symptom can come from a different contract boundary and require different cleanup.

The decisive interpretation for DISP_E_NOTACOLLECTION is that the selected dispatch object has no collection contract for the requested operation. For DISP_E_NOTACOLLECTION, keep the symbolic name beside the raw hexadecimal value so later analysis does not collapse the result into an unrelated COM family.

Where the result appears

  • DISP_E_NOTACOLLECTION is returned while Automation binds or executes generic Automation code attempting enumeration or indexed default-property access.
  • For DISP_E_NOTACOLLECTION, retain the member name and DISPID, invocation flags, LCID, cArgs, cNamedArgs, and the exact VARIANTARG sequence in reverse Automation order.
  • The output contract for DISP_E_NOTACOLLECTION includes puArgErr, EXCEPINFO, result VARIANT, by-reference values, and SAFEARRAY lock or ownership state; inspect them before cleanup.

Determine the object and lifecycle phase that owned DISP_E_NOTACOLLECTION; a UI symptom cannot establish whether the origin was the caller, proxy, runtime, server, or metadata producer.

Typical causes and interpretation boundary

Common cause categories for DISP_E_NOTACOLLECTION are: the caller received a scalar object; the wrong property was selected; a version removed collection behavior; default-member assumptions are invalid. For DISP_E_NOTACOLLECTION, evaluate these branches independently and require evidence from the owning API before promoting one branch to the root cause.

The check that separates DISP_E_NOTACOLLECTION from nearby HRESULTs is: the selected dispatch object has no collection contract for the requested operation. If the decisive fact for DISP_E_NOTACOLLECTION is unknown, keep the result unresolved and collect the missing state instead of inferring it from wording.

Evidence and telemetry

  • Record DISP_E_NOTACOLLECTION with the object CLSID or ProgID, interface identity, member DISPID, dispatch flags, and type-library version.
  • For DISP_E_NOTACOLLECTION, capture object type and IID; requested _NewEnum or Item member; invocation flags; type-info attributes; caller assumption.
  • Log VARIANT type tags, dimensions, bounds, lengths, and null/empty distinctions for DISP_E_NOTACOLLECTION, but redact actual confidential argument values.
  • Preserve the caller language/runtime, generated interop version, LCID, and whether the call crossed a process boundary when DISP_E_NOTACOLLECTION occurs.
  • After DISP_E_NOTACOLLECTION, call VariantClear, SysFreeString, SafeArrayDestroy, or release interfaces only for values whose ownership was transferred by the documented contract.

For DISP_E_NOTACOLLECTION, log identifiers, sizes, type tags, states, and hashes while excluding credentials, tokens, document payloads, and complete user arguments.

Diagnostic sequence

  • Capture DISP_E_NOTACOLLECTION (0x80020011) at IDispatch::GetIDsOfNames or IDispatch::Invoke before the language runtime converts it to a script exception.
  • For <code>DISP_E_NOTACOLLECTION</code>, resolve the deployed member signature from ITypeInfo and compare its DISPIDs, parameter flags, VARTYPEs, optional values, and property-put rules with the caller.
  • Prove the decisive condition for DISP_E_NOTACOLLECTION: the selected dispatch object has no collection contract for the requested operation.
  • Inspect the likely binding or representation causes for DISP_E_NOTACOLLECTION: the caller received a scalar object; the wrong property was selected; a version removed collection behavior; default-member assumptions are invalid.
  • Reconstruct DISPPARAMS exactly, including reverse positional ordering and named argument placement, then reproduce DISP_E_NOTACOLLECTION with the smallest value set.
  • Verify the result VARIANT, EXCEPINFO, puArgErr, by-reference arguments, SAFEARRAY lock count, and object state after DISP_E_NOTACOLLECTION before deciding on retry.

Correct handling and recovery

For DISP_E_NOTACOLLECTION, the appropriate recovery is to query documented collection interfaces or members, branch on capability, and avoid treating every IDispatch object as enumerable. The owner of retry for DISP_E_NOTACOLLECTION must define idempotency, refreshed state, maximum attempts, backoff, and cancellation responsibility.

After DISP_E_NOTACOLLECTION, apply the API-specific validity rules to outputs and release only resources whose ownership transferred during this attempt.

Practical scenario

A scripting adapter receives a single worksheet rather than a worksheets collection and stops requesting _NewEnum.

A regression test for DISP_E_NOTACOLLECTION should force the decisive precondition, assert native outputs, fix only that condition, and confirm the expected neighboring result.

Difference from related HRESULTs

DISP_E_BADINDEX means a collection exists but the index is invalid; DISP_E_NOTACOLLECTION means collection behavior is absent.

Represent this distinction for DISP_E_NOTACOLLECTION directly in control flow and dashboards instead of grouping it under a single COM-failure label.

Developer and administrator guidance

Automation adapters should handle DISP_E_NOTACOLLECTION at the dispatch boundary and expose the member, parameter, and type information needed to repair the call. A generic retry after <code>DISP_E_NOTACOLLECTION</code> with unchanged DISPPARAMS usually repeats the same deterministic binding error.

For DISP_E_NOTACOLLECTION, deployment owners should compare the registered type library and server binary as one versioned unit. After <code>DISP_E_NOTACOLLECTION</code>, re-registering arbitrary DLLs or changing locale system-wide is inappropriate unless the captured metadata proves registration or LCID drift.

References


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