| Previous | Next |
| DV_E_STGMEDIUM | DV_E_LINDEX |
DV_E_STATDATA
Invalid STATDATA structure
DV_E_STATDATA is the failure HRESULT 2147745895 (0x80040067, signed -2147221401) from winerror.h. AllStat defines it as “Invalid STATDATA structure”. In practical terms, a STATDATA advisory record is internally inconsistent or unusable. Interpret it in the context of enumerating or consuming data-change advisory connections.
The high bit in 0x80040067 is set, so this is a failure rather than a success or informational result. Its facility field is 4 (FACILITY_ITF) and its low 16-bit code is 103 (0x0067). Those bit fields classify the value, but they do not identify the failing object by themselves; the native method, object identity, and first producer of DV_E_STATDATA remain essential.
Contract boundary
Understanding DV_E_STATDATA requires this subsystem context: COM data-transfer structures are compound contracts: a field can be numerically well formed yet invalid for the provider, object generation, requested aspect, or ownership rules. For DV_E_STATDATA, diagnosis therefore has to preserve the complete descriptor and the exact method that consumed it.
- Associate
DV_E_STATDATAwith one exact operation in IDataObject, FORMATETC/STGMEDIUM negotiation, data advisory enumeration, or OLE rendering. - Confirm that
DV_E_STATDATAcame from enumerating or consuming data-change advisory connections, rather than from cleanup or a wrapper that ran afterward. - Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded
DV_E_STATDATA; the HRESULT alone should not erase a more specific cause.
Likely cause branches
DV_E_STATDATAcan result when the FORMATETC member contains a format/aspect/medium combination that the data object never accepted.DV_E_STATDATAcan result when pAdvSink is null, already released, or belongs to a disconnected proxy.DV_E_STATDATAcan result when dwConnection is stale because DUnadvise or object teardown already removed that advisory connection.
Evidence to preserve
A useful DV_E_STATDATA incident records the IDataObject identity, method, clipboard format, aspect, lindex, tymed mask, target-device size, advisory cookie, and ownership of every returned interface or medium. For DV_E_STATDATA, also retain the application and component build, architecture, process and thread IDs, COM apartment, operation correlation ID, elapsed time, and the first state-changing event before the failure. When logging DV_E_STATDATA, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.
- For
DV_E_STATDATA, inspect each STATDATA field rather than treating the structure as an opaque blob. - For
DV_E_STATDATA, compare the cookie with the current IDataAdviseHolder or IDataObject generation. - For
DV_E_STATDATA, verify that the enumerator and every returned IAdviseSink remain alive while the record is read.
Diagnostic sequence
- Capture
DV_E_STATDATAat the first native return before a wrapper maps it to a generic exception. - Identify the exact object, method, and lifecycle phase involved in enumerating or consuming data-change advisory connections.
- Inspect each STATDATA field rather than treating the structure as an opaque blob.
- Compare the cookie with the current IDataAdviseHolder or IDataObject generation.
- Verify that the enumerator and every returned IAdviseSink remain alive while the record is read.
- Reproduce
DV_E_STATDATAwith one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.
Recovery and retry
Correction. For DV_E_STATDATA, discard the bad advisory snapshot, rebuild the connection through DAdvise, and enumerate again from the current object. Retry boundary. Retry only after creating a fresh advisory connection; repeating the same STATDATA record cannot repair its fields or lifetime. Before repeating the DV_E_STATDATA operation, release every returned STGMEDIUM according to pUnkForRelease, retain advisory cookies only after successful DAdvise, and discard enumerated formats after the data object is replaced.
Practical scenario
A container restores persisted advisory metadata but the saved connection cookie belongs to the prior object instance; a new DAdvise call returns a valid cookie and sink. This isolates DV_E_STATDATA within COM data transfer and advisory connections and provides a regression test for the stated correction.
Difference from related HRESULTs
DV_E_FORMATETC concerns the transfer descriptor itself, while DV_E_STATDATA concerns the larger advisory record that also carries the sink, flags, and connection cookie. For DV_E_STATDATA, keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.
Developer and administrator guidance
For DV_E_STATDATA, copy complete FORMATETC and DVTARGETDEVICE structures, preserve signed lindex values, intersect tymed masks before requesting data, and encode STGMEDIUM ownership explicitly. Regression coverage for DV_E_STATDATA should include provider-advertised versus caller-invented formats, supported and unsupported DVASPECT/tymed combinations, sentinel lindex values, malformed target-device sizes, and replacement during advisory callbacks.
Operational repair for DV_E_STATDATA must target the evidence-backed owner: compare the data provider, consumer, and registered handler versions; repair a handler only when traces identify that provider as missing or incompatible. Retain before-and-after traces for DV_E_STATDATA so the change can be attributed and reversed.
References
- Microsoft: generic COM error codes — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: HRESULT values — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: IDataObject — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: FORMATETC structure — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: IViewObject — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: STATDATA structure — official Microsoft documentation relevant to
DV_E_STATDATA. - Microsoft: IDataObject::EnumDAdvise — official Microsoft documentation relevant to
DV_E_STATDATA.
Looking for a different code? Search another status or error code.
