What does HRESULT 0x887A0031 (DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION) mean?

 
Previous Next
DXGI_ERROR_HW_PROTECTION_OUTOFMEMORY DXGI_ERROR_NON_COMPOSITED_UI

DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION

What Windows rejected: dynamic code policy violation

DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, value 0x887A0031, is produced by dxgi error when the graphics component would require dynamic executable code that the process policy forbids. The investigation should stay attached to process mitigation policy during device creation and to the exact generation in which it was obtained.

DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION: Do not erase all shader caches or recreate every graphics object before preserving the first failing call. For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, Cache, policy, remote-session and device-lifetime failures have different recovery rules. For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, the built-in one-line message identifies the immediate result; diagnosis also needs the producing API, object ownership and the display generation current at the time.

Build a useful diagnostic record

Capture itemWhy it matters for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION
Decisive captureProcessDynamicCodePolicy, device-creation flags, selected adapter, loaded user-mode driver modules and signing state
Current graph stateDXGI factory, adapter, device, resource or cache session
Supporting traceDXGI debug messages, adapter LUID, driver version, device-removal reason where applicable and the exact API parameters
Object identityprocess mitigation policy during device creation
Rejected boundarythe graphics component would require dynamic executable code that the process policy forbids

For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, preserve the unsigned HRESULT, symbolic name, first failing API and timestamp in one record. If cleanup later fails too, keep that secondary result separately from DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION.

Separate state from capability

  1. Freeze the DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION generation. Record ProcessDynamicCodePolicy, device-creation flags, selected adapter, loaded user-mode driver modules and signing state. Before diagnosing DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, do not resize, hot-plug, recreate or release the object under examination.
  2. Run the narrow DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION comparison. create the same device in a test process with and without the dynamic-code restriction. During the DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION comparison, keep every driver, monitor, resource format and unrelated policy unchanged.
  3. Observe the layer after DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION. For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, if the exact check passes, record the next HRESULT or visible outcome. A different downstream result shows that the DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION boundary was crossed.
  4. Repeat DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION through a lifecycle transition. For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, exercise one relevant resize, mode switch, device recreation, hot-plug or session change and confirm that this result does not reuse stale handles.

The comparison with DXGI_ERROR_SDK_COMPONENT_MISSING is especially useful: DXGI_ERROR_SDK_COMPONENT_MISSING indicates an unavailable development component, not a mitigation conflict. For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, recording both names prevents a broad “graphics error” label from merging distinct ownership, capability and lifetime problems.

Verify the repaired path

Use a compatible signed graphics path or redesign the process boundary; do not silently weaken mitigation for the whole application. Repair of DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION is complete only when the original call succeeds or returns its documented nonfatal status and the same lifetime test remains correct after a second display transition.

  • The DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION trace identifies one producing API and one current graphics object, rather than only the final UI symptom.
  • The passing run changes exactly the condition described for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION; unrelated adapter, monitor and application state remains unchanged.
  • For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, debug-layer, ETW or driver diagnostics no longer report the rejected process mitigation policy during device creation contract during the same scenario.
  • The application handles recurrence of DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION without an unbounded retry loop, leaked resource, duplicate composition target or stale topology handle.

Implementation notes for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION

For DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, log DXGI debug messages, adapter LUID, driver version, device-removal reason where applicable and the exact API parameters. When the DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION path returns a count, size, status flag or replacement object, retain it even on a nonfatal result because it can direct the next call.

A production fallback for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION should be explicit: pause rendering, re-enumerate, rebuild one cache entry, recreate a device, or decline a protected path only when this layer calls for that action. Reinstalling every display component, deleting all caches or forcing a resolution change is not an evidence-based fix for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION.

Technical references


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