NullReferenceException in DestroyWindow on dialog close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One of my users is getting a NullReferenceException (Object reference not set
to an instance of an object) when they hit the Ok button on one of my dialogs.

Below is the exception's stack trace:

at System.Windows.Forms.UnsafeNativeMethods.IntDestroyWindow(HandleRef hWnd)
at System.Windows.Forms.UnsafeNativeMethods.DestroyWindow(HandleRef hWnd)
at System.Windows.Forms.NativeWindow.DestroyHandle()
at System.Windows.Forms.Control.DestroyHandle()
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()

The form does contain a ActiveX control, although I'm not sure if it makes a
difference. I seem unable to reproduce the error on other machines. What
could this error be caused by?
 
It appears calling Dispose() on the activex control during the Closing event
will fix this. Why, I have no idea.
 
Back
Top