| 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 item | Why it matters for DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION |
|---|---|
| Decisive capture | ProcessDynamicCodePolicy, device-creation flags, selected adapter, loaded user-mode driver modules and signing state |
| Current graph state | DXGI factory, adapter, device, resource or cache session |
| Supporting trace | DXGI debug messages, adapter LUID, driver version, device-removal reason where applicable and the exact API parameters |
| Object identity | process mitigation policy during device creation |
| Rejected boundary | the 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
- Freeze the
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATIONgeneration. Record ProcessDynamicCodePolicy, device-creation flags, selected adapter, loaded user-mode driver modules and signing state. Before diagnosingDXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, do not resize, hot-plug, recreate or release the object under examination. - Run the narrow
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATIONcomparison. create the same device in a test process with and without the dynamic-code restriction. During theDXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATIONcomparison, keep every driver, monitor, resource format and unrelated policy unchanged. - Observe the layer after
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION. ForDXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION, if the exact check passes, record the next HRESULT or visible outcome. A different downstream result shows that theDXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATIONboundary was crossed. - Repeat
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATIONthrough a lifecycle transition. ForDXGI_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_VIOLATIONtrace 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_VIOLATIONwithout 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
- Microsoft: DXGI error codes — background for the process mitigation policy during device creation boundary involved in
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION. - Microsoft: DXGI overview — background for the process mitigation policy during device creation boundary involved in
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION. - Microsoft: Direct3D 12 shader cache StoreValue — background for the process mitigation policy during device creation boundary involved in
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION. - Microsoft: Handle device-removed scenarios — background for the process mitigation policy during device creation boundary involved in
DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION.
Looking for a different code? Search another status or error code.