views:

304

answers:

2

I have a WPF application, that is sometimes freezing for maybe a half minute and then works fine. I am thinking to profile that application. Anybody knows a good tutorial of how to profile WPF application? Or anybody has any idea on finding a way to know when it is freezing? The freezing is not consistent, and not related to any usage pattern

Thanks for help.

Ghassan

+4  A: 

There is a toolset in the Windows SDK called WPFPerf - it has a set of tools (like Perforator) that help specifically with WPF debugging and profiling. Here's a quick guide on these tools.

For general .net profiling, RedGate Ants or JetBrains' dotTrace are great. There is also some profiling included in Visual Studio 2005/2008 (and better ones in 2010?).

Philip Rieck
A: 

Profiling is overkill. During that half minute, it's waiting for something. Just pause it and see what it's waiting for.

Mike Dunlavey
While I agree that this is a good technique to use in general, I disagree that it is always caused by an infinite loop. There could be blocking going on by some API waiting for a resource. There's a lot of reasons your UI could freeze that are not related to an infinite loop. I only say this just to make sure no one goes on a wild goose chase.
Anderson Imes
@Anderson: OK, I re-worded it to take out the "nearly infinite loop" part. The principle is the same. During that half minute, it's in a state in which it is waiting for something, after which it will resume useful work. Just pause it, and you'll see what it's waiting for, whether it's a low-level loop, getting a resource, whatever. People think this is hard, and it's not.
Mike Dunlavey