I have a RadGridView with a default sort descriptor defined in xaml for my grid.
Wen i run the project, if i press return two times, an exception is trown.
Application: WpfApplication3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
at System.Collections.Generic.ArraySortHelper`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at System.Array.BinarySearch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at Telerik.Windows.Data.KeyedCollection.IndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.IndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.Contains(System.Object)
at Telerik.Windows.Data.DataItemCollection.Contains(System.Object)
at Telerik.Windows.Controls.GridView.GridViewDataControl.CanActivateRowExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CommandBinding.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection, System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.UIElement.OnCanExecuteThunk(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CanExecuteRoutedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.RoutedCommand.CriticalCanExecuteWrapper(System.Object, System.Windows.IInputElement, Boolean, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.RoutedCommand.CanExecuteImpl(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
at System.Windows.Input.RoutedCommand.CriticalCanExecute(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(System.Windows.Input.KeyEventArgs)
at System.Windows.UIElement.OnKeyDownThunk(System.Object, System.Windows.Input.KeyEventArgs)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawKeyboardActions, Int32, Boolean, Boolean, Int32)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(System.Windows.Interop.MSG ByRef, System.Windows.Input.ModifierKeys)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.HwndSource+WeakEventPreprocessMessage.OnPreprocessMessage(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at WpfApplication3.App.Main()
the folowing code, reproduces my issue.
Wen i run the project, if i press return two times, an exception is trown.
Application: WpfApplication3.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
at System.Collections.Generic.ArraySortHelper`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at System.Array.BinarySearch[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon[], Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BinarySearch(Int32, Int32, System.__Canon, System.Collections.Generic.IComparer`1<System.__Canon>)
at Telerik.Windows.Data.KeyedCollection.IndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.IndexOf(System.Object)
at Telerik.Windows.Data.QueryableCollectionView.Contains(System.Object)
at Telerik.Windows.Data.DataItemCollection.Contains(System.Object)
at Telerik.Windows.Controls.GridView.GridViewDataControl.CanActivateRowExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CommandBinding.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection, System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.FindCommandBinding(System.Object, System.Windows.RoutedEventArgs, System.Windows.Input.ICommand, Boolean)
at System.Windows.Input.CommandManager.OnCanExecute(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.UIElement.OnCanExecuteThunk(System.Object, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.CanExecuteRoutedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.RoutedCommand.CriticalCanExecuteWrapper(System.Object, System.Windows.IInputElement, Boolean, System.Windows.Input.CanExecuteRoutedEventArgs)
at System.Windows.Input.RoutedCommand.CanExecuteImpl(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
at System.Windows.Input.RoutedCommand.CriticalCanExecute(System.Object, System.Windows.IInputElement, Boolean, Boolean ByRef)
at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(System.Windows.Input.KeyEventArgs)
at System.Windows.UIElement.OnKeyDownThunk(System.Object, System.Windows.Input.KeyEventArgs)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawKeyboardActions, Int32, Boolean, Boolean, Int32)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(System.Windows.Interop.MSG ByRef, System.Windows.Input.ModifierKeys)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.HwndSource+WeakEventPreprocessMessage.OnPreprocessMessage(System.Windows.Interop.MSG ByRef, Boolean ByRef)
at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at System.Windows.Application.Run()
at WpfApplication3.App.Main()
the folowing code, reproduces my issue.
<Window x:Class="WpfApplication3.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525"> <Grid><telerik:RadGridView x:Name="grid" ItemsSource="{Binding Itens}"> <telerik:RadGridView.SortDescriptors> <telerik:SortDescriptor Member="Id" SortDirection="Ascending" /> </telerik:RadGridView.SortDescriptors></telerik:RadGridView> </Grid></Window>public class Item{ public int Id { get; set; } public string Name { get; set; }}public class ViewModel{ public ObservableCollection<Item> Itens { get; set; } public ViewModel() { this.Itens = new ObservableCollection<Item>(); Itens.Add(new Item() { Name = "teste", Id = 0 }); Itens.Add(new Item() { Name = "teste 1", Id = 1 }); Itens.Add(new Item() { Name = "teste 2", Id = 2 }); }}public partial class MainWindow : Window{ public MainWindow() { this.DataContext = new ViewModel(); InitializeComponent(); }}