Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my WPF application slow on certain systems

I have problems with the performance of the UI of my WPF application on certain systems. On my developer system it performs just fine, on certain other systems however the performance is really bad. The problem occurs e.g. when moving splitters, resizing FlowDocuments or hovering over buttons.

The performance difference is not directly related to the obvious ‘specs’ of the computer. The application performs OK on a netbook (Intel Atom N550, 1GB RAM, Windows performance index: 2.0), but not on a desktop computer (I7 2600, 8GB Ram, ATI Radeon HD 5700, Windows performance index: 7.4). Both systems are running Windows 7. The application is build with .NET 4.0. I have tried to force software rendering using RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly. This however makes no difference at all.

What is causing this problem? How can I fix it?

like image 762
FromTheMountain Avatar asked Jul 13 '11 12:07

FromTheMountain


1 Answers

This sounds like it might be the Wpf 4 bug we were stung by that affects apps with complex Wpf visual trees. It's discussed in this thread http://social.msdn.microsoft.com/Forums/en/windowsaccessibilityandautomation/thread/6c4465e2-207c-4277-a67f-e0f55eff0110. It even affected the Workflow 4 designer in VS 2010 - see http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/1f20c37f-1b9e-4b6d-904f-a6b518e4187a. According to that thread, there is a hotfix that you might want to try: http://support.microsoft.com/kb/2484841

You can get a good idea if this is the problem by attaching a debugger to your app when it is hung / stuttering and see if you see lots of UiAutomation InvalidateAutomationAncestors frames on the stack.

like image 112
fubaar Avatar answered Oct 07 '22 05:10

fubaar