We have used DispatcherTimer for updating datetime in label in WPF Application.
Its tick event stopped working after exception.
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
We have added Dispactch undhandled exception to catch all unhandled exception.
this.Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException);
Error call of DispatcherTimer tick event (devide by zero ). After exception application handled the call to UnhandledException & then stopped calling DispatcherTimer tick event.
void timer_Tick(object sender, EventArgs e)
{
ServerClock = ServerClock.AddSeconds(1);
int a = 0;
int i = 1 / a;
}
What is stopping tick event to run in another tick?