-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
.NET version
.NET 8.0.100-preview.7.23330.16
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
It also repro's in .NET 7.0.
Issue description
In Winforms repo, there has a DemoConsole test app, System.InvalidCastException: 'Unable to cast object of type 'Entry' to type 'System.String'.' Occurs after adding an item of ComboBox in a DemoConsole application.
combobox.mp4
Call Stack:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'Entry' to type 'System.String'.
Source=System.Windows.Forms.Design
StackTrace:
at System.Windows.Forms.Design.StringCollectionEditor.StringCollectionForm.OKButton_click(Object sender, EventArgs e) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\Windows\Forms\Design\StringCollectionEditor.StringCollectionForm.cs:line 158
at System.Windows.Forms.Control.OnClick(EventArgs e) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.cs:line 7729
at System.Windows.Forms.ButtonBase.OnClick(EventArgs e) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ButtonBase.cs:line 889
at System.Windows.Forms.Button.OnClick(EventArgs e) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Button.cs:line 249
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Button.cs:line 276
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.cs:line 12347
at System.Windows.Forms.Control.WndProc(Message& m) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.cs:line 13122
at System.Windows.Forms.ButtonBase.WndProc(Message& m) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ButtonBase.cs:line 1466
at System.Windows.Forms.Button.WndProc(Message& m) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Button.cs:line 375
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.ControlNativeWindow.cs:line 64
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.ControlNativeWindow.cs:line 113
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\NativeWindow.cs:line 373
at Windows.Win32.PInvoke.DispatchMessage(MSG* lpMsg)
at System.Windows.Forms.Application.ComponentManager.Microsoft.Office.IMsoComponentManager.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Application.ComponentManager.cs:line 291
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Application.ThreadContext.cs:line 1069
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Application.ThreadContext.cs:line 935
at System.Windows.Forms.Application.RunDialog(Form form) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Application.cs:line 1176
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) in C:\Users\xx\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Form.cs:line 5381
at System.Windows.Forms.Design.EditorServiceContext.System.Windows.Forms.Design.IWindowsFormsEditorService.ShowDialog(Form dialog) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\Windows\Forms\Design\EditorServiceContext.cs:line 163
at System.ComponentModel.Design.CollectionEditor.CollectionForm.ShowEditorDialog(IWindowsFormsEditorService edSvc) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\CollectionEditor.CollectionForm.cs:line 186
at System.ComponentModel.Design.CollectionEditor.EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\CollectionEditor.cs:line 251
at System.Windows.Forms.Design.ListControlStringCollectionEditor.EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\Windows\Forms\Design\ListControlStringCollectionEditor.cs:line 31
at System.Windows.Forms.Design.EditorServiceContext.EditValue(ComponentDesigner designer, Object objectToChange, String propName) in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\Windows\Forms\Design\EditorServiceContext.cs:line 61
at System.Windows.Forms.Design.ListControlUnboundActionList.InvokeItemsDialog() in C:\Users\xx\winforms\src\System.Windows.Forms.Design\src\System\Windows\Forms\Design\ListControlUnboundActionList.cs:line 21
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Steps to reproduce
Test sample: DemoConsole in Winforms repo
