WPF application freezes completely for 1 minute
I have the following, very weird problem with my WPF app in production environment:
- The customer reports the program is extremely slow. Sometimes the entire interface freezes for about one minute
- During this "freeze" there is no CPU activity. Other programs still work fine
- The issue always occurs when the user is physically behind the PC. That is, when I login using RDP or TeamViewer the problem is very hard to reproduce, although I've seen it happening
- To make it even more strange: this company has 开发者_JAVA百科about 40 PC's with identical hardware. Only in 5 of them this problem occurs (PC: HP Compaq 6000 Pro Small Form Factor)
I will visit the company in a few days to have physical acces to the PC.
One thing to note: this program runs in about 1000 companies without problems, which makes me think there is a problem with the hardware.
How would you diagnose such an issue? Which tools? Any tips or pointers?
Thanks all for the suggestions. I tried various of them. In this case the comment from Ray was most helpful, he said:
"I wonder if doing something similar to this: blogs.technet.com/b/markrussinovich/archive/2010/12/07/… and this: blogs.technet.com/b/markrussinovich/archive/2010/01/13/… would help diagnose the problem. – Ray Sep 16 at 9:32"
The Process Monitor pointed out then when the app was idle, there were various reads from the registry related to Direct3D. This made the video card driver suspicous. I've removed the driver and installed a newer version (we've tried this earlier, but now there was an even newer update). This update fixed the issue.
I noticed a similar behavior in our lab. The app freezes often, but either no CPU, nor networking activity. Same behavior on many PCs, both on old- and new-machines.
Finally I got it. Since the app uses web-services, and -for default- the proxy is "auto" detecting, the discovering is freezing everything for several seconds.
By setting the proxy as null, everything is going all right.
http://msdn.microsoft.com/en-us/library/fze2ytx2.aspx
If the problem is WPF related you should check for common performance bottlenecks like costly data bindings or UI events that occur frequently and involve heavy processing in your app. A profiler is an invaluable tool in this situation, some good ones are Red Gate Performance profiler and AQTime from SmartBear Software. Another nice tool is Snoop, WPF Spy Utility that allows to analyze the UI objects tree. If this tree has unnecessary objects, consider trimming.
精彩评论