wpf icon indicating copy to clipboard operation
wpf copied to clipboard

Avoid UCEERR_RENDERTHREADFAILURE

Open petsuter opened this issue 9 months ago • 5 comments
trafficstars

Fixes #9042

Main PR

Description

WPF applications with D3DImage can crash when a monitor is off or unavailable and IDirect3D9.GetAdapterMonitor returns NULL. For example on laptops with connected HDMI external display and display setting “Extend” and control panel “when I close the lid” = “Do nothing”, when closing the lid or on sleep / awake.

Customer Impact

WPF applications crash.

Regression

This bug exists in existing .NET releases like 4.8.

Testing

Take a laptop with connected HDMI external display and set display setting “Extend” and control panel “when I close the lid” = “Do nothing”, then close the lid and check if a WPF application with D3DImage crashes.

Risk

Unclear.

Microsoft Reviewers: Open in CodeFlow

petsuter avatar Feb 04 '25 09:02 petsuter

The fix looks reasonable to me and should probably be backported to .NET Framework, did you try out your solution? The "Testing" part is referring to how the PR changes were tested.

miloush avatar Feb 04 '25 10:02 miloush

No, I have no time to test it sorry. I just run into the crash all the time. Maybe @Const-me tested it. See https://github.com/dotnet/wpf/issues/9042#issuecomment-2112139487

petsuter avatar Feb 04 '25 10:02 petsuter

or @vladimir-cheverdyuk-altium, especially since this one requires particular hardware setup

miloush avatar Feb 04 '25 10:02 miloush

particular hardware setup

A notebook and a monitor?

petsuter avatar Feb 04 '25 16:02 petsuter

This also happens with a two monitor setup. Start the application on the primary monitor, disconnect the cable from the machine (the application gets moved to the second screen). Now you have the same exception.

It alsof happens when you remote desktop to a two monitor machine, disconnect the session and reconnect.

Hope these extra cases help to fix the problem faster, it's really annoying.

Wimmeh avatar Apr 02 '25 12:04 Wimmeh

Thank you @petsuter for the contribution!

harshit7962 avatar Jul 11 '25 10:07 harshit7962