Last Updated: 09 Mar 2021 12:29 by ADMIN
Release LIB 2021.1.315
Created on: 09 Feb 2021 10:34
Category: Window
Type: Bug Report
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)
Martin Ivanov
Posted on: 16 Feb 2021 10:55


Thank you for the additional information. We will have it in mind when we start working on the fix.

Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

Posted on: 10 Feb 2021 06:47


The problem reproduces for RadWindowManager->windows collection and WindowHostBase->hosts collection. Our client reported both stack traces. Those collections are not thread safe and both have items removed from them when windows are closing. 


thank you.