dotnet/wpf · critical · InvalidOperationException
WGXERR_UCE_RENDERTHREADFAILURE
WGXERR_UCE_RENDERTHREADFAILURE
Error message
SR.MediaContext_RenderThreadError
What it means
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.
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.
Example fix
// before // app crashes: render thread error, no mitigation // after // App startup: mitigate driver/GPU issues via software rendering RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
Defensive patterns
Strategy: retry
Validate before calling
// Detect risky environments (RDP, tier 0) and disable acceleration up front: bool risky = System.Windows.SystemParameters.RemoteSession || (RenderCapability.Tier >> 16) < 1; if (risky) RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
Try / catch
catch (InvalidOperationException ex) when (ex.Message.Contains("render")) { LogRenderThreadFailure(ex); RecreateVisualTreeOrRestartRender(); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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).
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- D3DERR_OUTOFVIDEOMEMORY
- E_OUTOFMEMORY
- PrintSystemException.PrintQueue.XpsDeviceQuery
- SR.MediaContext_NoBadShaderHandler
- Win32Exception (native Win32 error from DuplicateHandle…
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/fac955ddec6cb215.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MediaContext.cs:428
/// rendering or presentation error and will require us to reconnect.
/// </summary>
private void NotifyPartitionIsZombie(int failureCode)
{
//
// We only get back these kinds of notification:-
// For all OOM cases, we get E_OUTOFMEMORY.
// For all OOVM cases, we get D3DERR_OUTOFVIDEOMEMORY and
// for all other errors we get WGXERR_UCE_RENDERTHREADFAILURE.
//
switch (failureCode)
{
case HRESULT.E_OUTOFMEMORY:
throw new System.OutOfMemoryException();
case HRESULT.D3DERR_OUTOFVIDEOMEMORY:
throw new System.OutOfMemoryException(SR.MediaContext_OutOfVideoMemory);
default:
throw new System.InvalidOperationException(SR.MediaContext_RenderThreadError);
}
}
/// <summary>
/// The back channel processed a malformed packet and so gives
/// the notification of invalid packet.
/// </summary>
private void HandleInvalidPacketNotification()
{
//
// -
// For now we ignore the packet and continue processing
// other packets. In future, we could also close this channel.
//
}
/// <summary>
/// Tier Property - returns the current render tier for this MediaContext.View on GitHub (pinned to 81131a70a4)