Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Desktop Composition Is Disabled Error

Tags:

c#

wpf

In my WPF application on .NET 4.0, I am having users report two errors that seem very intermittent and I cannot get a handle on. Below, I am posting the message and the top-most line of the stack trace. I can post the full stack trace if needed.

Message:       {Desktop composition is disabled} The operation could not be completed because desktop composition is disabled. (Exception from HRESULT: 0x80263001)
StackTrace:    at Standard.NativeMethods.DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS& pMarInset)

Message:       Insufficient memory to continue the execution of the program.
StackTrace:    at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()

Google is not proving very helpful, so I was hoping maybe you guys have seen them before.

like image 777
TrialAndError Avatar asked Jun 19 '13 22:06

TrialAndError


People also ask

What is Enable desktop composition?

When desktop composition is enabled, individual windows no longer draw directly to the screen or primary display device as they did in previous versions of Windows. Instead, their drawing is redirected to off-screen surfaces in video memory, which are then rendered into a desktop image and presented on the display.

What is desktop composition in Remote desktop?

Select Desktop Composition (RDP 6.0 onwards) to allow desktop composition. With desktop composition, individual windows no longer draw directly to the screen. Instead, their drawing is redirected to video memory, which is then rendered into a desktop image and presented on the display. Click Save Changes or Save + New.

How do I turn off desktop composition?

This turns it off every time you start the game. Apply, and exit. If you want to just totally disable it at all times, right click on my computer, go to advanced system settings on the left, then the advanced tab, and click on performance and from there you can disable composition entirely.


1 Answers

I finally was able to nail down the issue - graphics adapter driver.

This post, along with this one helped me figure it out. Basically, what happened is I had 4 users (out of about 600) that were experiencing issues. They also reported that their screens would flicker at random times and some reported 'task bars turning solid'. This would be what caused the DWM composition error, and apparently if they had multiple programs running that were intensively using the graphics card, it would run out of memory.

I tested using Geeks3d.com FurMark benchmarking program to max out the graphics card then launched my application. It would crash upon opening and throw the outofmemory exception, so I know it wasn't a memory leak.

After updating the driver, I was unable to generate the crash...even with multiple programs AND FurMark running at full blast.

Hopefully this helps someone down the road.

like image 105
TrialAndError Avatar answered Oct 28 '22 13:10

TrialAndError