What does HRESULT 0x88985001 (DWRITE_E_UNEXPECTED) mean?

 
Previous Next
DWRITE_E_FILEFORMAT DWRITE_E_NOFONT

DWRITE_E_UNEXPECTED

DWRITE_E_UNEXPECTED belongs to an unexpected DirectWrite condition. DirectWrite encountered an unexpected internal condition but documents the result as safe for the caller to recover from. The diagnostic goal for DWRITE_E_UNEXPECTED is to identify the first rejecting object and transition, not merely the final high-level symptom.

Read the HRESULT in context

For DWRITE_E_UNEXPECTED, DirectWrite documents this status as recoverable, but recovery does not remove the need to identify the object and callback that reached an unexpected state. When DWRITE_E_UNEXPECTED is returned, custom font loaders, face construction, shaping, glyph analysis, and rendering parameters each have different lifetimes and data contracts.

For DWRITE_E_UNEXPECTED, inspect the following boundary: the exact DirectWrite object and operation, especially custom loaders, font parsing, shaping, or glyph analysis.

Capture before changing state

RecordWhy it matters here
Factory version and object interfaceFor DWRITE_E_UNEXPECTED, recording factory version and object interface separates the an unexpected DirectWrite condition boundary from a later wrapper symptom.
Font loader key, file identity, face index, and simulationsIn DWRITE_E_UNEXPECTED diagnostics, recording font loader key, file identity, face index, and simulations ties the HRESULT to the an unexpected DirectWrite condition boundary rather than to the final visible failure.
Text range, script, locale, and rendering parametersComparing text range, script, locale, and rendering parameters shows whether DWRITE_E_UNEXPECTED follows input, object state, or environment.
First method and any custom callback resultPreserving first method and any custom callback result provides the evidence needed to test this distinction: cACHEFORMAT and CACHEVERSION identify cache-file conditions; UNSUPPORTEDOPERATION is a capability result. UNEXPECTED is the broader internal fallback.

A minimal test sequence

Create a fresh factory and a system-font baseline, then add the custom loader, font file, text properties, and glyph operation separately in the DWRITE_E_UNEXPECTED path. For DWRITE_E_UNEXPECTED, rebuilding uncertain objects is safer than continuing from a callback sequence whose invariants are unknown.

  1. For DWRITE_E_UNEXPECTED, recreate the smallest factory and font face that reproduces.
  2. When DWRITE_E_UNEXPECTED is returned, compare system font loading with the custom loader path.
  3. Use a known-good font and simple text to isolate the object in the DWRITE_E_UNEXPECTED path.
  4. For DWRITE_E_UNEXPECTED, release and rebuild DirectWrite objects rather than reusing uncertain state.

Three diagnostic branches

TestInterpretationHold constant
Same environment, reduced inputIf DWRITE_E_UNEXPECTED disappears with a smaller faithful case, complexity within an unexpected DirectWrite condition is implicated.For DWRITE_E_UNEXPECTED, keep factory version and object interface fixed while simplifying text range, script, locale, and rendering parameters.
Same input, fresh object generationIf DWRITE_E_UNEXPECTED changes after rebuilding state, examine ownership across font loader, font file or cache reader, face construction, shaping or glyph operation, and caller fallback.For DWRITE_E_UNEXPECTED, place font loader key, file identity, face index, and simulations on the timeline of the last successful transition.
Same operation on a controlled second pathIf DWRITE_E_UNEXPECTED follows one environment, the failure is not explained by source data alone.For DWRITE_E_UNEXPECTED, compare OS build, DirectWrite version, font source, process architecture, locale, and rendering parameters while preserving first method and any custom callback result.

Common wrong turns

CACHEFORMAT and CACHEVERSION identify cache-file conditions; UNSUPPORTEDOPERATION is a capability result. UNEXPECTED is the broader internal fallback. For DWRITE_E_UNEXPECTED, do not suppress the HRESULT just because recovery is permitted; preserve the font and call sequence so the unexpected path can be fixed.

Regression verification

A correction for DWRITE_E_UNEXPECTED should let the operation at the an unexpected DirectWrite condition boundary complete repeatedly under the original supported conditions. Repeat the control that begins with “Recreate the smallest factory and font face that reproduces” and confirm that the following lifecycle step also succeeds. For DWRITE_E_UNEXPECTED, keep the original failing sample and one deliberate negative case so fallback cannot be mistaken for repair.

Technical references

When DWRITE_E_UNEXPECTED is returned, these references define the public API family, object model, or error list used to interpret this status.


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