Unhandled exception pops up when using Accessibility tools to focus on date button in MonthCalendar
See original GitHub issue.NET version
8.0.100-alpha.1.22430.2
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes, it is a regression issue, cannot repro .Net 6.0 and previous, repro in .Net 7.0
Issue description
Unhandled exception pops up when using Accessibility tools to focus on date button in MonthCalendar
System.InvalidOperationException HResult=0x80131509 Message=Collection was modified after the enumerator was instantiated. Source=System.Collections StackTrace: at System.Collections.Generic.LinkedList`1.Enumerator.MoveNext() at System.Windows.Forms.MonthCalendar.CalendarRowAccessibleObject.DisconnectChildren() at System.Windows.Forms.MonthCalendar.CalendarBodyAccessibleObject.DisconnectChildren() at System.Windows.Forms.MonthCalendar.CalendarAccessibleObject.DisconnectChildren() at System.Windows.Forms.MonthCalendar.MonthCalendarAccessibleObject.RebuildAccessibilityTree() at System.Windows.Forms.MonthCalendar.MonthCalendarAccessibleObject.OnMonthCalendarStateChanged(Object sender, EventArgs e) at System.Windows.Forms.MonthCalendar.WmCalViewChanged(Message& m) at System.Windows.Forms.MonthCalendar.WmReflectCommand(Message& m) at System.Windows.Forms.MonthCalendar.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) at Interop.User32.SendMessageW(IntPtr hWnd, WM Msg, IntPtr wParam, IntPtr lParam) at Interop.User32.SendMessageW(IHandle hWnd, WM Msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.Control.ReflectMessage(IntPtr hWnd, Message& m) at System.Windows.Forms.Control.WmNotify(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) at Interop.User32.CallWindowProcW(IntPtr wndProc, IntPtr hWnd, WM msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) at Interop.User32.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context) at WinFormsApp8.Program.Main() in C:\Users\xxxx\source\repos\WinFormsApp8\WinFormsApp8\Program.cs:line 14
Steps to reproduce
Repro Steps:
- Create a Winforms .Net Core application with MonthCalendar added
- Build and run application
- Launch Narrator, focus on MonthCalendar, and then click Date button on the top
or use attached test app: MonthCalendarSample.zip
Actual result: Unhandled exception pops up
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Verified on .NET 7.0 test pass build: .NET 7.0.100-rc.2.22476.6, issue is fixed without exception, Gif as below:
Verified this issue in the latest .Net 8.0 SDK build: 8.0.100-alpha.1.22469.15, it is fixed without exception