microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

High CPU Usage in WinUI App When Screen is Locked on Remote Desktop Due to DWMCOREI.dll

Open ahmadkurdo opened this issue 1 year ago • 14 comments

Describe the bug

Environment: Operating System: See screenshots Driver version: See additional context

Description: When running Xelion, a WinUI application on a remote desktop, there is a significant increase in CPU usage when the screen is locked. After thorough investigation, the high CPU usage was traced back to the DWMCOREI.dll, which is used by the WinUI application. We have found a quick workaround to fix this. For more info about the workaround visit the following link

Steps to reproduce the bug

  1. Connect to a remote desktop. Use the remote desktop app you can download it here.
  2. Install Xelion 8 using the following link: Xelion 8 Installer.
  3. Run the Xelion app.
  4. Log in to the Xelion app. For credentials, you may contact me.
  5. Open Task Manager.
  6. Lock the screen (e.g., press Windows + L).
  7. Unlock the screen.
  8. Observe in Task Manager that the Xelion app initially uses a high amount of CPU power for a short period before decreasing. However, when the screen is locked, the app continues to consume a high amount of CPU power.

Expected behavior

The CPU usage of the WinUI app should remain consistent and not significantly increase when the screen is locked on a remote desktop.

Screenshots

Schermafbeelding 2024-06-05 165809 Schermafbeelding 2024-06-05 170817 Schermafbeelding 2024-06-05 171436 Schermafbeelding 2024-06-05 171456 Schermafbeelding 2024-06-05 171507 Schermafbeelding 2024-06-05 171617 Schermafbeelding 2024-06-05 172629 Schermafbeelding 2024-06-06 113530 Schermafbeelding 2024-06-06 123117

NuGet package version

WinUI 3 - Windows App SDK 1.5.3: 1.5.240428000

Windows version

Windows 10 Enterprise for Virtual Desktops

Additional context

DeviceName DriverVersion


Audio Endpoint 10.0.19041.1 Generic Non-PnP Monitor 10.0.19041.4355 Microsoft Remote Display Adapter 10.0.19041.4355 Audio Endpoint 10.0.19041.1 Audio Endpoint 10.0.19041.1 Generic software device 10.0.19041.1 Generic software device 10.0.19041.1 Generic Non-PnP Monitor 10.0.19041.4355 Generic Non-PnP Monitor 10.0.19041.4355 Generic Non-PnP Monitor 10.0.19041.4355 Microsoft Remote Display Adapter 10.0.19041.4355 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Network Printer Connection 10.0.19041.1 Local Print Queue 10.0.19041.1 Network Printer Connection 10.0.19041.1 Local Print Queue 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Microsoft enhanced Point and Print driver 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Microsoft enhanced Point and Print driver 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Microsoft enhanced Point and Print driver 10.0.19041.1 Microsoft enhanced Point and Print driver 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Microsoft enhanced Point and Print driver 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Local Print Queue 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Network Printer Connection 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 Local Print Queue 10.0.19041.1 WAN Miniport (Network Monitor) 10.0.19041.1 WAN Miniport (IPv6) 10.0.19041.1 WAN Miniport (IP) 10.0.19041.1

WAN Miniport (PPPOE) 10.0.19041.1 WAN Miniport (PPTP) 10.0.19041.1 WAN Miniport (L2TP) 10.0.19041.1 WAN Miniport (IKEv2) 10.0.19041.1 WAN Miniport (SSTP) 10.0.19041.1 Generic software device 10.0.19041.1 Generic software device 10.0.19041.1 Generic software device 10.0.19041.1 Remote Desktop Device Redirector Bus 10.0.19041.1 Plug and Play Software Device Enumerator 10.0.19041.1 Microsoft System Management BIOS Driver 10.0.19041.1 NDIS Virtual Network Adapter Enumerator 10.0.19041.1 Microsoft Basic Render Driver 10.0.19041.3636 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 AMD Processor 10.0.19041.4355 System CMOS/real time clock 10.0.19041.3636 Microsoft Hyper-V Generation Counter 10.0.19041.1 Communications Port 10.0.19041.1 Mellanox ConnectX-4 Lx Virtual Etherne... 2.70.24728.0 Microsoft Hyper-V Virtual PCI Bus 10.0.19041.4355 Microsoft Hyper-V Network Adapter 10.0.19041.4355 Generic PnP Monitor 10.0.19041.4355 Microsoft Hyper-V Video 10.0.19041.3636 Microsoft Hyper-V Virtual Keyboard 10.0.19041.1 HID-compliant mouse 10.0.19041.1 Microsoft Hyper-V Input 10.0.19041.1 Microsoft Hyper-V Dynamic Memory 10.0.19041.1

Microsoft Hyper-V SCSI Controller 10.0.19041.3636 Disk drive 10.0.19041.4355 Microsoft Hyper-V SCSI Controller 10.0.19041.3636 Microsoft Hyper-V Time Synchronization 10.0.19041.1 Microsoft Hyper-V Guest Shutdown 10.0.19041.1 Microsoft Hyper-V Data Exchange 10.0.19041.1 Microsoft Hyper-V Heartbeat 10.0.19041.1

Microsoft Hyper-V Virtual Machine Bus 10.0.19041.4355 Advanced programmable interrupt contro... 10.0.19041.3636 ACPI Module Device 10.0.19041.3636 Microsoft ACPI-Compliant System 10.0.19041.4355 ACPI x64-based PC 10.0.19041.1 Remote Desktop Mouse Device 10.0.19041.1 Remote Desktop Keyboard Device 10.0.19041.1 UMBus Enumerator 10.0.19041.1 Remote Desktop Camera 10.0.19041.3636 UMBus Enumerator 10.0.19041.1 Remote Desktop USB Hub 10.0.19041.4355 UMBus Enumerator 10.0.19041.1 UMBus Enumerator 10.0.19041.1 Remote Desktop Mouse Device 10.0.19041.1 Remote Desktop Keyboard Device 10.0.19041.1 UMBus Enumerator 10.0.19041.1 UMBus Root Bus Enumerator 10.0.19041.1 Microsoft Kernel Debug Network Adapter 10.0.19041.1 Microsoft Storage Spaces Controller 10.0.19041.4355 Disk drive 10.0.19041.4355 Microsoft VHD Loopback Controller 10.0.19041.3930 Microsoft Virtual Drive Enumerator 10.0.19041.1 Composite Bus Enumerator 10.0.19041.1 Microsoft Hyper-V Virtualization Infra... 10.0.19041.4355 Microsoft Basic Display Driver 10.0.19041.3636 Volume 10.0.19041.1 Generic volume shadow copy 10.0.19041.1 Generic volume shadow copy 10.0.19041.1 Volume 10.0.19041.1 Volume 10.0.19041.1 Volume 10.0.19041.1 Volume 10.0.19041.1 Volume Manager 10.0.19041.3636

ahmadkurdo avatar Jun 06 '24 10:06 ahmadkurdo

The linked thread indicates KB4522355 resolved the issue--are you still seeing the issue?

riverar avatar Jun 06 '24 15:06 riverar

The linked thread indicates KB4522355 resolved the issue--are you still seeing the issue?

Hi, i dont see KB4522355 anywhere. What do you mean by that?

ahmadkurdo avatar Jun 07 '24 08:06 ahmadkurdo

@ahmadkurdo

*** PROBLEM RESOLVED BY KB4522355 RELEASED OCTOBER 24TH 2019. ***

kmgallahan avatar Jun 07 '24 12:06 kmgallahan

@riverar I think KB4522355 will not solve this issue. It happens in a later Windows version that was fully patched. Apart from that, the issue is somewhat different, although both related to DWM.

wbokkers avatar Jun 11 '24 11:06 wbokkers

What is the status of this issue?

wbokkers avatar Oct 08 '24 12:10 wbokkers

Same here, a WinUI-based process randomly consumes high cpu, even when the window is closed or minimized.

This is what procexp shows: Image

marticliment avatar Oct 16 '24 22:10 marticliment

It looks PowerToys has had a similar issue: https://github.com/microsoft/PowerToys/pull/29665

marticliment avatar Oct 16 '24 22:10 marticliment

In fact, I have found this issue to happen on other WinUI3 apps, such as PowerToys. Image

Same thread, same start adress, high CPU usage after the program's window has loaded

marticliment avatar Oct 17 '24 22:10 marticliment

@Saharsh979 This issue was closed without any explanation. Could you please provide some context on why? When closing issues, a brief comment explaining the reasoning is standard practice across open source projects. Without the context, we're left guessing whether this was resolved, deprioritized, or closed in error. Thanks!

riverar avatar Dec 01 '25 04:12 riverar

And why closing as not planned? Are unreasonable cpu usages when idle not going to be fixed?

marticliment avatar Dec 01 '25 05:12 marticliment

Hi @riverar @marticliment The closure was automated when the linked internal ADO bug got marked resolved.

To add context: the investigation concluded that this behavior is due to a limitation in the current lifted compositor implementation it doesn’t have awareness of the screen on/off state. Because of that limitation, there isn’t anything WinUI can directly do in this scenario today. I’m following up internally to get more clarity and will update this issue so everyone tracking it has the right context. We can reopen this if additional info comes up or if this becomes a scenario the compositor starts supporting.

Sorry for the confusion caused by the auto-close!

Saharsh979 avatar Dec 01 '25 06:12 Saharsh979

@Saharsh979 This is unacceptable. We have many clients using our app on RDS complaining for over a year about this issue. Why isn't this issue escalated to the right level in your organization instead? I understand that another department is needed to fix this issue, but are the boundaries between MS departments this impenetrable?

wbokkers avatar Dec 01 '25 07:12 wbokkers

Hello there @wbokkers! Sorry about the miscommunication on our part. With OSS of the repo in progress, we are trying to consolidate practices amongst several teams. I am currently the PM for composition. We are aware of this issue and trying to prioritize for timeline currently. Stay tuned.

beth-panx avatar Dec 05 '25 20:12 beth-panx

@beth-panx Thanks for the clarification and the update. Much appreciated!

wbokkers avatar Dec 05 '25 20:12 wbokkers