The Windows 7 window manager regularly detects my WPF app as being hung, ghosts it and pops up a not responding message. I've been using the app for several weeks and haven't seen it but a user with the same hardware as me says he gets it regularly.
Everything that can be is run in a task on another thread, so I'm not sure where to begin looking for the issue. If the user waits for the application to respond it recovers quickly so I'm assuming the issue is something on the GUI thread that occasionally takes just over 5 seconds to run.
Is there any way I can detect when the DWM thinks the app has hung so I can log a stack trace?
I haven't done this in a WPF app, but the traditional way would be to send a WM_NULL message from a background thread every so often using SendMessageTimeout, and if the main UI thread doesn't process the message in, say, 30 seconds, generate a stack dump for that thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With