MalcomTucker
MalcomTucker

Reputation: 7477

How to debug a hanging WPF application?

I have a WPF application that is hanging on one user's machine. Other users aren't affected. The app hangs both running natively out of the development environment and whilst running under debug. The problem can be reproduced reliably - it simply hangs whatever the user attempts to do. Running under debug offers no clues, no exception is thrown, the app simply stops responding.

What options do I have for debugging this? Are there any external tools - things like sysinternals suite for example - that can help? Are there any Visual Studio debugger tricks or tips that might provide a bit more info?

Upvotes: 3

Views: 3188

Answers (3)

tsells
tsells

Reputation: 2771

Check your hardware acceleration for the machine. Remember WPF uses direct hardware access for rendering when available. You can try reducing your acceleration, updating your video drivers, etc.

What operating system is this running under? If Windows 7 - is Aero enabled?

Upvotes: 0

Yahia
Yahia

Reputation: 70369

Since this is a rather general description only general pointers:

  • hit "pause" in the debugger and see where it hangs
  • patch the system + drivers to the latest "stable level"
  • check any 3rd-party assemblies you are using
    perhaps there is some quirk regarding version and/or configuration and/or dependency
  • use sysinternal processmon to check what the app does (which files are accessed etc.)
  • check network connectivity and configuration (proxy, DNS, firewall etc.) if your app uses anything (like a network share or DB or internet access etc.)
  • check RAM (perhaps the machine is paging like crazy...)
  • if your app is multi-threaded there can be exceptions "lurking" => try adding global handlers to get a clue (see here)
  • Font problems can be another issue to account for... see here
  • check for antivirus etc. => these can sometimes create strange behaviour

anything of the above could give you a clue what's going on.

Upvotes: 2

Wiktor Zychla
Wiktor Zychla

Reputation: 48230

Yes, you can use mdbg.exe to attach to the hanging process (a PID) and when you are there press w to see the stack trace.

btw. the hanging could possibly be caused by the corrupted font cache so before you try the mdbg try to find the instruction on how to clear the WPF's font cache.

Upvotes: 3

Related Questions