Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException when disposing and control has focus #27

Open
cvogt61457 opened this issue Mar 28, 2024 · 0 comments
Open

NullReferenceException when disposing and control has focus #27

cvogt61457 opened this issue Mar 28, 2024 · 0 comments

Comments

@cvogt61457
Copy link

There is a NullReferenceException when disposing and control has focus.

When disposing, the FieldControls and LabelControls are disposed.
The base.Dispose(disposing) is then called.

A NullReferenceException is thrown from inside the base.Dispose().
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at IPAddressControlLib.IPAddressControl.get_Focused()
at IPAddressControlLib.IPAddressControl.OnLostFocus(EventArgs e)
at System.Windows.Forms.Control.WmKillFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

It appears that get_Focused() accesses the null _fieldControls causing the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant