microsoft / WPFDXInterop

Repo for WPF DX Interop support
MIT License
307 stars 98 forks source link

UCEERR_RENDERTHREADFAILURE when switching presentation modes #22

Open mgarstenauer opened 8 years ago

mgarstenauer commented 8 years ago

The application WpfD3D11Interop crashes when switching the Windows presentation display modes in a multi-monitor setup.

Steps to reproduce the problem (requires multi-monitor setup):

  1. Run WpfD3D11Interop.
  2. Press Win+P and select another presentation display mode (such as "Second screen only"). (Sometimes you have to repeat step 2 a few times.)

Exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in PresentationCore.dll

Additional information: UCEERR_RENDERTHREADFAILURE (Exception from HRESULT: 0x88980406)

Stack trace:

   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

The Call Stack window in Visual Studio tells me that the application hangs in PresentationCore.dll!System.Windows.Interop.D3DImage.Lock().

smischke commented 6 years ago

I have filed a bug report: https://connect.microsoft.com/VisualStudio/feedback/details/3141623