{"record":{"id":"fac955ddec6cb215","repo":"dotnet/wpf","slug":"wgxerr-uce-renderthreadfailure","errorCode":"WGXERR_UCE_RENDERTHREADFAILURE","errorMessage":"SR.MediaContext_RenderThreadError","messagePattern":"SR\\.MediaContext_RenderThreadError","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs","lineNumber":428,"sourceCode":"        /// rendering or presentation error and will require us to reconnect.\n        /// </summary>\n        private void NotifyPartitionIsZombie(int failureCode)\n        {\n            //\n            // We only get back these kinds of notification:-\n            // For all OOM cases, we get E_OUTOFMEMORY.\n            // For all OOVM cases, we get D3DERR_OUTOFVIDEOMEMORY and\n            // for all other errors we get WGXERR_UCE_RENDERTHREADFAILURE.\n            //\n\n            switch (failureCode)\n            {\n            case HRESULT.E_OUTOFMEMORY:\n                throw new System.OutOfMemoryException();\n            case HRESULT.D3DERR_OUTOFVIDEOMEMORY:\n                throw new System.OutOfMemoryException(SR.MediaContext_OutOfVideoMemory);\n            default:\n                throw new System.InvalidOperationException(SR.MediaContext_RenderThreadError);\n            }\n        }\n\n        /// <summary>\n        /// The back channel processed a malformed packet and so gives\n        /// the notification of invalid packet.\n        /// </summary>\n        private void HandleInvalidPacketNotification()\n        {\n            //\n            // -\n            // For now we ignore the packet and continue processing\n            // other packets. In future, we could also close this channel.\n            //\n        }\n\n        /// <summary>\n        /// Tier Property - returns the current render tier for this MediaContext.","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs#L410-L446","documentation":"For any other render-thread partition failure code (notably WGXERR_UCE_RENDERTHREADFAILURE), NotifyPartitionIsZombie throws InvalidOperationException(SR.MediaContext_RenderThreadError). The MIL/UCE render thread died or misbehaved and WPF cannot continue rendering on this partition.","triggerScenarios":"The render channel reports a partition failure with an unrecognized/other HRESULT (default case), typically a general UCE render-thread failure: driver crash, invalid command batch, or corrupted channel state.","commonSituations":"Faulty/outdated graphics drivers, GPU driver timeout/reset (TDR), running in RDP or virtualized sessions with poor acceleration, or bugs triggered by exotic visual-tree content (e.g., huge layered windows).","solutions":["Update or reinstall the GPU driver; reproduce on another machine/GPU to isolate driver issues.","Switch the app to software rendering (RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly) to bypass the render thread's hardware path.","Disable animations/effects/large caches in the app to reduce render-thread workload.","Capture the failure HRESULT via logs and, if it maps to a known WPF bug, apply the servicing fix for the targeted .NET Framework version."],"exampleFix":"// before\n// app crashes: render thread error, no mitigation\n// after\n// App startup: mitigate driver/GPU issues via software rendering\nRenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;","handlingStrategy":"retry","validationCode":"// Detect risky environments (RDP, tier 0) and disable acceleration up front:\nbool risky = System.Windows.SystemParameters.RemoteSession || (RenderCapability.Tier >> 16) < 1;\nif (risky) RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;","typeGuard":null,"tryCatchPattern":"catch (InvalidOperationException ex) when (ex.Message.Contains(\"render\")) { LogRenderThreadFailure(ex); RecreateVisualTreeOrRestartRender(); }","preventionTips":["Keep GPU drivers current on target machines","Avoid visuals known to stress the UCE (huge layered windows, exotic effects)","Log the underlying HRESULT for support diagnostics","Provide a software-rendering escape hatch controlled by config"],"tags":["wpf","render-thread","gpu","driver","zombie-partition"],"backgroundTag":"internal-invariant-violation","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}