i find a threadexception happenning in NativeWindow.Callback as in Stacktrace below, probably related to some winforms Timer i may be using since [TimerNativeWindow.OnThreadException found in stacktrace].
Stacktrace
TestApp.application_ThreadException(Object sender, ThreadExceptionEventArgs e)
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Timer.TimerNativeWindow.OnThreadException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
In Application.ThreadException handler, i try to show friendly message using Form.ShowDialog at which point NativeWindow.Callback kicks in firing the tick event for that timer where i get an exception like below.
System.NullReferenceException: Object reference not set to an instance of an object.
at TestTimer.timer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
When calling form.ShowDialog from the threadexception handler, Is there a way to avoid timer tick event from firing due to NativeWindow.Callback.
Thx