From 153e2060c0dd4f40298285e2ccffa12de809d7e5 Mon Sep 17 00:00:00 2001 From: Peter Suter Date: Tue, 4 Feb 2025 10:20:29 +0100 Subject: [PATCH] Avoid UCEERR_RENDERTHREADFAILURE Fix https://github.com/dotnet/wpf/issues/9042 --- .../src/WpfGfx/core/hw/InteropDeviceBitmap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/hw/InteropDeviceBitmap.cpp b/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/hw/InteropDeviceBitmap.cpp index 64199522668..b0bfcb314fd 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/hw/InteropDeviceBitmap.cpp +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/hw/InteropDeviceBitmap.cpp @@ -845,6 +845,10 @@ CInteropDeviceBitmap::GetDisplayFromUserDevice( IFC(pID3DUserDevice->GetDirect3D(&pID3DUserObject)); HMONITOR hMon = pID3DUserObject->GetAdapterMonitor(m_uAdapter); + if(hMon == NULL) + { + hMon = ::MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); + } g_DisplayManager.GetCurrentDisplaySet(&pDisplaySet); UINT uDisplayIndex;