Last Updated:
09 Mar 2021 12:29
by ADMIN
Window: ArgumentOutOfRangeException when closing windows in multithreaded application
ArgumentOutOfRangeException can be thrown when showing/closing windows in a multi-threaded application. Here's a possible stack trace:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.RemoveAt(Int32 index)
at System.Collections.Generic.List`1.Remove(T item)
at Telerik.Windows.Controls.RadWindowManager.RemoveWindow(WindowBase window)
at Telerik.Windows.Controls.WindowBase.OnClosed()
at Telerik.Windows.Controls.RadWindow.OnClosed()
at Telerik.Windows.Controls.WindowBase.CloseHostImidiately()
at Telerik.Windows.Controls.WindowBase.TryClose(Boolean shouldCloseHost)
at Telerik.Windows.Controls.WindowBase.Telerik.Windows.Controls.InternalWindow.IWindowDragAware.TryClose(Boolean shouldCloseHost)
at Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.OnWindowClosing(Object sender, CancelEventArgs e)
at System.Windows.Window.OnClosing(CancelEventArgs e)
at System.Windows.Window.WmClose()
at System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)