Skip to content
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

[PTRun] System.Runtime.InteropServices.COMException: {Desktop composition is disabled} #31226

Open
AlexDeMoura opened this issue Feb 1, 2024 · 27 comments
Labels
Issue-Bug Something isn't working Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Priority-1 Bug that is high priority Product-PowerToys Run Improved app launch PT Run (Win+R) Window

Comments

@AlexDeMoura
Copy link

Microsoft PowerToys version

0.78.0.0

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

General

Steps to reproduce

When I was choosing a font in the font menu of Excel, the screen went dark for one second or something, and it came back showing this window: Power Toys Run ran into an issue. Something went wrong. The attached log contents:
2024-02-01.txt
The following software was running under an updated Windows 10 (8 MB RAM, 18 GB fixed VM, GPU0 Intel HD 530, GPU1 NVidia not active):

  1. One File Explorer window in the folder containing the Excel file I was working on;
  2. One Opera One (version: 105.0.4970.34) densely tabbed window, with Update stream: Stable, under System: Windows 10 64-bit (WoW64), and Chromium version:119.0.6045.199 - Browser identification: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0 - Installation type:
    Stand-alone installation (USB), but the opera is installed in a C: folder (I love portable stuff, you know - portable means freedom);
  3. One Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17318.20000) 64-bit running a single <70 KB file in a C: folder;
  4. Background software running in Taskbar: PowerToys 0.78.0.0 (updated yesterday) and five more apps. OneDrive, Webroot anti-virus, f.lux v4.131 (screen brightness management), and two Lenovo hardware monitors (bundled software);
  5. Plus, a lot of stuff in Task Manager that I don't care and it is too much to post here, but it includes at least a bunch of Adobe processes and a half dozen MS Edge processes, even if the Acrobat, Photoshop, and Edge browser are not in use. By the way, MS Edge is the default browser - but I am not a great fan. I like Opera Portable better.

The fonts menu in Excel contains many Asian fonts, mainly Hebraic versions of the most common MS Office fonts. I was choosing one of them (Arial, Calibri, or Roboto) for a single cell.
The screen background contains a static picture (no Slideshow) from the Pinnula Dynamic Theme (background management, last version) installed from the Microsoft Store.

✔️ Expected Behavior

Such things shouldn't be happening. It gives me the creeps and sometimes a heart attack. But I like the PowerToys so much, I don't want to uninstall it. The ones I use the most are (in this order):

  1. Text Extractor: a lot, but with limited capability of Microsoft OCR Packs (please give me my Tesseract) - ORP files, two installed: English and Portuguese - both are just... fair;
  2. PowerRename: powerful, despite I hate REGEX with all my guts - I do NOT care what Chomsky said about it - I consider this "language" as LASHEMO (LAzy SHorthand for English MOnoglots). Down with ASCII and its keyboards - welcome UNICODE! Long live the REPUBLICA and the Excel functions, the world's only translatable computer language, but the MS ORPs can't recognize those functions as a text to be OCRed - go figure. I would use an 'extended' MS-DOS BATCH language mixed with some old BASIC string functions and maybe some well-known Excel string functions, but that is me. No need to change - but some numbering (01, 02, ...) or alphabetic itemization (a., b., ...) without using REGEX I think it is necessary;
  3. Color Picker: nice - a loveable one. It needs a few more features to become perfect, such as optional picker areas larger than a single pixel - I suggest 8-around-1 and 16-around-9 - and a few more standard color libraries such as Munsell for painting, the European/German RAL mainly used in varnish, powder coating, and plastics, and the IEC 60062:2016 RKM code for electronic components. The world was not made for software developers only, you know.
  4. Shortcut Guide: it is OK, but why is it limited to [WIN] key's functions only on a single screen? Why combinations aren't available while the Shortcut Guide is ON the screen? Such as, after the Shortcut Guide shows, press [SHIFT] and all [SHIFT]+[WIN] functions appear, press [ALT] and all [ALT]+[WIN] functions show up, press [CTRL] and we have all [CTRL]+[WIN] functions on the screen, and so on - but the thing vanishes with any key pressed or any mouse click.

Is there any Browser Selector (by link, domain, or user's choice) in your roadmap? Or is it against THE company's policy?

Am I asking too much? I appreciate your work, but you guys opened Pandora's box - it was full of users' wishes.

❌ Actual Behavior

Thank God the computer didn't freeze this time, but it already happened once this year. I didn't lose the work - I continued to work on the Excel spreadsheet. No other app was closed - however, I had to restart Excel since its visual elements and components, such as buttons, menus, bars, and a few others, went black or empty (with their background color only).

Thanks for your excellent work, and best regards.

Other Software

No response

@AlexDeMoura AlexDeMoura added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Feb 1, 2024
@jaimecbernardo jaimecbernardo added the Product-PowerToys Run Improved app launch PT Run (Win+R) Window label Feb 1, 2024
@jaimecbernardo
Copy link
Collaborator

[2024-02-01 00:10:25.7737] [FATAL]

Exception

System.Runtime.InteropServices.COMException: {Desktop composition is disabled} The operation could not be completed because desktop composition is disabled. (0x80263001)
   Source: PresentationFramework
   TargetAssembly: PresentationFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
   TargetModule: PresentationFramework.dll
   TargetSite: Void DwmExtendFrameIntoClientArea(IntPtr, Standard.MARGINS ByRef)
   at Standard.NativeMethods.DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS& pMarInset)
   at System.Windows.Shell.WindowChromeWorker._ExtendGlassFrame()
   at System.Windows.Shell.WindowChromeWorker._UpdateFrameState(Boolean force)
   at System.Windows.Shell.WindowChromeWorker._HandleDwmCompositionChanged(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Shell.WindowChromeWorker._WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   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)

Environment

  • Command Line: C:\zz\D\Util\PowerToys_user\PowerToys.PowerLauncher.dll -powerToysPid 12720 --started-from-runner
  • Timestamp: 02/01/2024 00:10:25
  • Wox version: 0.78.0.0
  • OS Version: Microsoft Windows NT 10.0.19045.0
  • IntPtr Length: 8
  • x64: True
  • CLR Version: 8.0.1
  • Installed .NET Framework:
    • v2.0.50727 2.0.50727.4927 SP2
    • v3.0 3.0.30729.4926 SP2
    • v3.5 3.5.30729.4926 SP1
    • v4 Client 4.8.09037
    • v4 Full 4.8.09037
    • v4.0 Client 4.0.0.0

@jaimecbernardo jaimecbernardo added the Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. label Feb 1, 2024
@davidegiacometti
Copy link
Collaborator

This is a duplicate of #30507

@gokcekantarci
Copy link
Contributor

/needinfo

Hi,
Desktop composition should always be enabled.
https://learn.microsoft.com/en-us/windows/win32/dwm/wm-dwmcompositionchanged

I tried to force PTRun with some benchmark and stress tests but I couldnt reproduce it. Can you share your machine specs to check and compare?

I also found same issues in other apps too.
https://forums.bohemia.net/forums/topic/217460-computer-keep-crashing-and-here-is-the-log-error-can-someone-help/
https://itecnote.com/tecnote/c-desktop-composition-is-disabled-error/

Does this issue still persist? If so, please share the Task Manager screenshot with GPU priority and /bugreport to check PTRun settings you have.

Also please update your graphics card driver and try again.

Thanks,

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Feb 5, 2024
@AlexDeMoura
Copy link
Author

AlexDeMoura commented Feb 5, 2024 via email

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 5, 2024
@AlexDeMoura
Copy link
Author

AlexDeMoura commented Feb 5, 2024 via email

@Jay-o-Way
Copy link
Collaborator

Please update issue title to be more specific? :)

@AlexDeMoura
Copy link
Author

AlexDeMoura commented Feb 6, 2024 via email

@Jay-o-Way
Copy link
Collaborator

That's okay. Maybe one of the core people can :⁠-⁠)

@gokcekantarci gokcekantarci changed the title Power Toys Run ran into an issue. Something went wrong. [PTRun] System.Runtime.InteropServices.COMException: {Desktop composition is disabled} Feb 7, 2024
@Frooastside
Copy link

I have the same issue and it happened while installing a new Graphics Driver for my Intel Arc A770, maybe his graphics card that is not active still got some update or something like that

@chryscrz
Copy link

Hello had the same error message regarding desktop composition:

Version: 0.77.0.0 OS Version: Microsoft Windows NT 10.0.22631.0 IntPtr Length: 8 x64: True Date: 2/16/2024 10:28:43 Exception: System.Runtime.InteropServices.COMException (0x80263001): {Desktop composition is disabled} The operation could not be completed because desktop composition is disabled. (0x80263001) at Standard.NativeMethods.DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS& pMarInset) at System.Windows.Shell.WindowChromeWorker._ExtendGlassFrame() at System.Windows.Shell.WindowChromeWorker._UpdateFrameState(Boolean force) at System.Windows.Shell.WindowChromeWorker._HandleDwmCompositionChanged(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Shell.WindowChromeWorker._WndProc(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 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)

Happened while switching screens from HDMI to internal on my laptop (Ryzen CPU, AMD graphics).
Apparently the video driver crashed (timed-out) as well.

@eskimo682
Copy link

Also get this regularly (at least since Powertoys 0.72 until now). Also vmware. Seems to be connected to doing a cut/copy/paste-action at the same time as a dwminit happens and you get the black screen effect for a few seconds. Black screen often happens while debugging processes with Visual Studio 2022 but the copy/paste keypresses is what bring Powertoys down (humble guess). Only have Text extractor and Run installed.
The Desktop Window Manager process has exited. (Process exit code: 0x8898009b, Restart count: 2, Primary display device ID: VMware SVGA 3D)
Easily (?) reproduced by killing the display driver process multiple times in a 5 second loop and pressing CTRL-V. Again, my guess, too lazy to actually try it.

Granted, vmware has had this display driver problem for ages so it won't get fixed anytime soon if ever. But not having a display available really should't crash Powertoys. Either retry a few times during 10 seconds or silently ignore whatever you need the display/something for.

@AlexDeMoura
Copy link
Author

AlexDeMoura commented Dec 23, 2024

Firstly, I'd like to express my gratitude to the PowerToys team for finally addressing the issue plaguing many users, including myself, for almost a year. The persistent System.Runtime.InteropServices.COMException: {Desktop composition is disabled} was not only affecting PowerToys but also causing severe disruptions in other applications, including Office apps and even the entire Windows environment.

I understand that the team initially switched to WinUI for its better performance and modern features than older frameworks. However, this switch introduced significant new issues, including the one I and many others experienced.
I also acknowledge that the team switched back to WPF (Windows Presentation Foundation) on .NET to address this issue. WPF is a robust UI framework that allows developers to create rich desktop applications.
Additionally, there was a problem with High Contrast mode in recent versions of .NET, which caused crashes. The team is working on a fix for this, and in the meantime, they reverted to WPF to provide a temporary solution. This issue has been progressively problematic since November/December 2023 and became critical since version 0.78 of PowerToys, with the solution finally arriving in version 0.87.

Special thanks to @jaimecbernardo for merging the essential changes and to @mantaionut for their contributions. Your efforts are appreciated. (Sr. Bernardo, de coração, agradeço MESMO. Talvez o senhor não tenha déia do que passei mantendo "fielmente" o PT ativo, usando diariariamente algumas das ferramentas e vendo o Excel perder sua visualização durante o trabalho. Que Deus o abençoe e ao Sr. Manta).

While I appreciate these efforts, it's incredibly disheartening that it took almost a year to resolve such a critical issue. The prolonged delay in addressing this has been both frustrating and unacceptable, considering the impact on productivity and the severe disruptions caused. The PowerToys team must prioritize resolving significant issues promptly, especially when they are aware of the underlying causes.
I hope that in the future, the team will balance new feature development with the need to maintain stability and compatibility, ensuring that such prolonged disruptions are avoided.

Thank you for finally addressing this, and I look forward to a more stable experience with PowerToys moving forward.

Best regards and Merry Christmas.

@crutkas crutkas removed the Resolution-Already Fixed/Doesn't Apply A change in the product has made the issue obsolete. label Dec 27, 2024
@crutkas
Copy link
Member

crutkas commented Dec 27, 2024

Reopening as we're still seeing reports :(

@jaimecbernardo
Copy link
Collaborator

Hi @AlexDeMoura , thanks for your kind words.
One of the issues we have is that no one in the development team is able to reproduce this.
And it seems this fix ended up fixing it for some users and not others. Are you able to confirm it's fixed for you?
Thanks,
Jaime

@jaimecbernardo
Copy link
Collaborator

Happy Holidays too! ❤ 😄

@AlexDeMoura
Copy link
Author

Hi, @jaimecbernardo
On a scale from 0% to 100% where 0% needs to restart the computer from a dark screen to 100% is perfect working with no issues at all, between 85% to 95%. From my user's perspective, it needs some polishing.
I re-activated the Dynamic Theme (from MS Shop, a modern app) Slideshow, still using f.lux (bright control for eyes safety, never turned off), and tried the most aggressive experiments like Excel Font Menu. Except in sporadic cases, there is a fraction of a second of video freezing but everything is back to normal. In rare events, the video goes dark for 1 or 2 seconds, and then everything returns to normal. Such rare events also happen when I move a big picture, for example, on an Excel sheet.
For the first time, I also noticed some hiccups in images turned into video on the Night Café website running in a heavily tabbed portable Opera browser (v111 - Developer), only twice since the PT 0.88 version, with an Excel sheet, opened (not heavy). I don't know if it's related to it.
There have been no errors so far, from PT inversely to what happened in this new issue report (mentioned by @crutkas).

My hardware is still the same, with GPU0 Intel 530 as the only active one. GPU1 Nvidia is not in use for anything, no games or AI here. I can confirm there is no relation with none of those GPU updates: the Nvidia one because it needs my permission to install anything, so I can monitor it. But the Intel one is a concern for me because this is a Lenovo computer, and Lenovo unauthorized ANY update on the GPU driver despite Intel launching at least one update after the installed one.
So this is an "old" driver running a few high-intensity graphics demands such as an Excel Font Menu full of Asian and Hebraic fonts.
I am not a dark-themed guy. I keep most of the apps in their default interface. The f.lux controls the screen luminosity, and Dynamic Theme changes the images in the background on a default Windows 10 theme. As far as I can understand, the computer has nothing special related to video or graphics.

Some strong delays happen in my Custom Toolbar Menus (I have two of them) and also in the Desktop recovering from screensaver, restarting, logout/login, etc. In a few words, the Desktop is slow to complete. However, I cannot confirm they are related.
I understand the system is not 100% stable, and maybe, I am demanding too much from an 8 GB machine with an Intel processor that cannot be updated to Windows 11.
The problem is that if I turn PT off, most or even all these issues vanish as magic, but I need the PT tools mainly when I work on Excel. The rare times I checked the Desktop Composition in Registry I found nothing suspicious.

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Priority-1 Bug that is high priority Product-PowerToys Run Improved app launch PT Run (Win+R) Window
Projects
Status: ✅Done
Development

No branches or pull requests