Desktop Composition Is Disabled Error

The first error is related to the Aero Glass style that you are using in your WPF Window. When the user turns the glass theme off (and uses the basic theme) these Glass methods like DwmExtendFrameIntoClientArea fail. You therefore need to check whether Desktop Window Manager (DWM) composition is enabled:

[DllImport("dwmapi.dll", PreserveSig = false)] 
public static extern bool DwmIsCompositionEnabled(); 

The second problem seems to be an unmanaged bug. Check this very elaborate answer on another very similar question: https://stackoverflow.com/a/1965382/1255010


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.

Tags:

C#

Wpf