This is quite hard to reproduce, but by clicking around on the column headers to group and sort them quickly enough I can generate an exception similar to this:
System.ArgumentOutOfRangeException was unhandled
Message=Index must be within the bounds of the List.
Parameter name: index
Source=mscorlib
ParamName=index
StackTrace:
at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass36.<RequestGrouping>b__35()
at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
at Telerik.Windows.Controls.GridView.GridViewDataControl.RequestGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
at Telerik.Windows.Controls.GridView.DragDropController.OnGroupPanelDropInfo(Object sender, DragDropEventArgs e)
at Telerik.Windows.Controls.DragDrop.DragDropEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.DragDropProvider_DropInfo(Object sender, DragDropEventArgs e)
at Telerik.Windows.Controls.DragDrop.DragDropProviderBase.RaiseDropInfo()
at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnDrop()
at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnCoverRectangleMouseLeftButtonUpInternal()
at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnCoverRectangleMouseLeftButtonUp(Object sender, EventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, 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.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at Crash_Example.App.Main() in c:\users\matthewb\documents\visual studio 2010\Projects\Crash_Example\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I've made a small example project with a simple grid and can reproduce it there as well
(I can't see how I can attach it to this thread?)
The grid simply has 5 columns and 5000 rows
All I do is rapidly drag any column header into the grouping bar, remove it and change the sorting on it by clicking round like a mad man! It's quite random and sometimes takes as much as a minute to reproduce
Here's the XAML in case it helps:
<Window x:Class="Crash_Example.MainWindow" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" Title="Crash Example" Height="350" Width="525"> <telerik:RadGridView x:Name="TheGrid" Style="{StaticResource CrashGrid}"> <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding A}" UniqueName="A" Header="A" DisplayMemberPath="Data" SelectedValueMemberPath="Id" ItemsSourceBinding="{Binding Converter={StaticResource converter}, ConverterParameter=A, Mode=OneWay}" /> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding B}" UniqueName="B" Header="B" DisplayMemberPath="Data" SelectedValueMemberPath="Id" ItemsSourceBinding="{Binding Converter={StaticResource converter}, ConverterParameter=B, Mode=OneWay}" /> <telerik:GridViewColumn UniqueName="Arrow" Style="{StaticResource ArrowColumn}" /> <telerik:GridViewDataColumn UniqueName="C" Header="C"> <telerik:GridViewDataColumn.CellEditTemplate> <DataTemplate> <TextBox Text="{Binding C}" MaxLength="20" /> </DataTemplate> </telerik:GridViewDataColumn.CellEditTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn UniqueName="D" Header="D"> <telerik:GridViewDataColumn.CellEditTemplate> <DataTemplate> <TextBox Text="{Binding D}" MaxLength="20" /> </DataTemplate> </telerik:GridViewDataColumn.CellEditTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView></Window><Application x:Class="Crash_Example.App" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" xmlns:Crash_Example="clr-namespace:Crash_Example" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary> <Crash_Example:Converter x:Key="converter" /> <Style x:Key="CrashGrid" TargetType="telerik:RadGridView"> <Setter Property="AutoGenerateColumns" Value="False" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="CanUserInsertRows" Value="True" /> <Setter Property="CanUserReorderColumns" Value="False" /> <Setter Property="ClipboardPasteMode" Value="Cells" /> <Setter Property="DataLoadMode" Value="Asynchronous" /> <Setter Property="EditTriggers" Value="CellClick" /> <Setter Property="EnableColumnVirtualization" Value="True" /> <Setter Property="EnableRowVirtualization" Value="True" /> <Setter Property="IsFilteringAllowed" Value="False" /> <Setter Property="ItemsSource" Value="{Binding Path=Data}" /> <Setter Property="SelectionMode" Value="Extended" /> <Setter Property="ShowInsertRow" Value="False" /> </Style> <Style x:Key="ArrowColumn" TargetType="telerik:GridViewColumn"> <Setter Property="Background" Value="#FF727272" /> <Setter Property="IsEnabled" Value="False" /> <Setter Property="IsFilterable" Value="False" /> <Setter Property="IsGroupable" Value="False" /> <Setter Property="IsReadOnly" Value="True" /> <Setter Property="IsResizable" Value="False" /> <Setter Property="IsSortable" Value="False" /> <Setter Property="IsVisible" Value="True" /> <Setter Property="Width" Value="30" /> <Setter Property="CellTemplate"> <Setter.Value> <DataTemplate> <TextBlock Background="Transparent" Foreground="WhiteSmoke" FontWeight="Bold" FontFamily="Arial Unicode MS" HorizontalAlignment="Center"> ➨ </TextBlock> </DataTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources></Application>If anyone has any suggestions as to how I can improve the scrolling speed as well I'd be very grateful!
