-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One way to fix UCEERR_RENDERTHREADFAILURE #9042
Comments
Another test case which reproduces that crash.
I can confirm the source is correct. Your workaround didn’t work for me because I don't want to render the 3D content at refresh rate of the monitor, but I was able to workaround using MinHook to replace Implementing the fix on the WPF side would be way simpler. Literally 2 lines of code in
|
I know that are many reasons for this error but I found that for my case it was related to using D3DImage.
Here is link to the project that demonstrates problem : https://github.com/vladimir-cheverdyuk-altium/dx9host
Basically it is Microsoft code copied from here:
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/walkthrough-creating-direct3d9-content-for-hosting-in-wpf?view=netframeworkdesktop-4.8
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/walkthrough-hosting-direct3d9-content-in-wpf?view=netframeworkdesktop-4.8
It has project for .NET Framework and .NET6.
Steps:
Source of the problem
It looks like IDirect3D9.GetAdapterMonitor will return 0 because monitor is powered off (or unavailable) and function
pDisplaySet->GetDisplayIndexFromMonitor(hMon, uDisplayIndex)
inCInteropDeviceBitmap::GetDisplayFromUserDevice
will return E_INVALIDARG and this eventually will lead to crash.So to me it looks like issue is in D3DImage that connected to adapter 0 while adapter 0 is disconnected from monitor.
Fix*
To fix it I declared
private EventHandler renderingEventHandler;
inMainWindow.xaml.cs
then set rendering like this:and add these 2 lines to the end of constructor:
and lastly I added implementation:
and lastly I added 3rd parameter
true
to every call toSetBackBuffer
and removedd3dimg.IsFrontBufferAvailable
check inCompositionTarget_Rendering
.Does anybody know if this approach to detect monitor changes (using Microsoft.Win32.SystemEvents.DisplaySettingsChanging) is correct?
Just in case if somebody thing it is rare thing, we have 37933 crash reports from users for this issue. I'm not sure how many related to this particular reason but at least some are.
Here is one of reports from our customers: "I also get this issue on my Lenovo laptop when connecting/disconnecting external monitors." Some customers state that it happened when computer is going to sleep or perhaps when monitors going to sleep but I couldn't able to reproduce it.
The text was updated successfully, but these errors were encountered: