I've observed a bug in my UWP application where a DispatcherTimer
object no longer fires its tick method when I minimize the app (and still doesn't fire when the app is restored to focus as if the event handler has been unregistered), but only when running in non-debug mode (starting the app w/out debugging). However, in debug mode, even if I minimize the app, the tick event continues to fire.
My understanding in researching other threads on SO is that DispatcherTimer
runs on the UI thread. If the app is minimized and sent into a suspending state, does that stop the dispatcher loop and therefore the stopping of ticks? If so, why does that behavior not occur in debug mode?
When the debugger is attached, it ticks fine when the app is minimized.
If the app is minimized and sent into a suspending state, does that stop the dispatcher loop and therefore the stopping of ticks?
Short answer: Yes. If the app is suspended, there will be no Tick
events raised.
If so, why does that behavior not occur in debug mode?
Because the debugger becomes unresponsive as explained by @HansPassant.