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

PropertyGridView crashes on editing ListBoxProperty with null values #2316

Open
M-Lipin opened this issue Nov 7, 2019 · 0 comments
Assignees
Milestone

Comments

@M-Lipin
Copy link
Member

@M-Lipin M-Lipin commented Nov 7, 2019

  • .NET Core Version: 3.0
  • Have you experienced this same bug with .NET Framework?: Yes

Problem description:

Actual behavior:
Exception while trying to select the item in the list with null-value element:

Exception Thrown: System.ArgumentNullException: 'Key cannot be null.'

mscorlib.dll!System.Collections.Hashtable.ContainsKey(object key)
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.GridViewListBoxItemAccessibleObjectCollection.this[object].get(object key) Unknown
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.GridViewListBoxAccessibleObject.SetListBoxItemFocus() Unknown
System.Windows.Forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.GridViewListBox.OnSelectedIndexChanged(System.EventArgs e) Unknown
System.Windows.Forms.dll!System.Windows.Forms.ListBox.WmReflectCommand(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.ListBox.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) Unknown

Expected behavior:
No exception and no crash.

Minimal repro:

  1. Create WinForms app with PropertyGrid control and add some class definition with the collection property bound to a list editor. Create an instance of that class and add null value to the collection of items. Set this created instance to SelectedObject property of the PropertyGrid control.
  2. Run the app and try to select something in the list item in the PropertyGrid.
@M-Lipin M-Lipin self-assigned this Nov 7, 2019
@RussKie RussKie added the 🐞 bug label Nov 8, 2019
@RussKie RussKie added this to the Future milestone Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.