This is a migrated thread and some comments may be shown as answers.

System.ArgumentException - Source type must be an enumerable type.

1 Answer 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anatoliy
Top achievements
Rank 2
Anatoliy asked on 11 Aug 2016, 07:28 AM

Hi Telerik,

    We've got unhandled exception in yours sources.

    After applying filters for GridView which filter all existed items (with using ObservableCollection) we get such stack trace list:

01.System.Transactions Critical: 0 :
02.<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical">
04.    <Description>Unhandled exception</Description>
05.    <AppDomain>TimeTracking.Client.vshost.exe</AppDomain>
06.    <Exception>
07.        <ExceptionType>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
08.        <Message>Source type must be an enumerable type.</Message>
09.        <StackTrace>   at Telerik.Windows.Data.Expressions.EnumerableFilterOperatorExpressionBuilder.GenerateContainsMethodCall(Expression source, Expression value, Boolean shouldNegate)
10.   at Telerik.Windows.Data.Expressions.OperatorValueFilterDescriptorExpressionBuilderBase.CreateBodyExpression()
11.   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
12.   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
13.   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
14.   at Telerik.Windows.Data.Expressions.FilterExpressionBuilder.CreateFilterExpression()
15.   at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
16.   at Telerik.Windows.Data.QueryableCollectionView.CreateView()
17.   at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
18.   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
19.   at Telerik.Windows.Data.QueryableCollectionView.get_InternalCount()
20.   at Telerik.Windows.Data.QueryableCollectionView.get_IsEmpty()
21.   at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh(CurrencyRefreshInfo currencyRefreshInfo)
22.   at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
23.   at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh()
24.   at Telerik.Windows.Data.QueryableCollectionView.OnFilterDescriptorsChanged()
25.   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
26.   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
27.   at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
28.   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
29.   at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Add(Object value)
30.   at Telerik.Windows.Data.CollectionHelper.Equalize(IList left, IList right, IEqualityComparer comparer)
31.   at Telerik.Windows.Data.DataItemCollection.EqualizeFilterDescriptors()
32.   at Telerik.Windows.Data.DataItemCollection.EqualizeDescriptors()
33.   at Telerik.Windows.Data.DataItemCollection.set_CollectionView(QueryableCollectionView value)
34.   at Telerik.Windows.Data.DataItemCollection.CreateAndSetCollectionView(IEnumerable source, Type type)
35.   at Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source, Type type)
36.   at Telerik.Windows.Controls.GridView.GridViewDataControl.&lt;&gt;c__DisplayClass20.&lt;Bind&gt;b__1f()
37.   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
38.   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnApplyTemplate()
39.   at System.Windows.FrameworkElement.ApplyTemplate()
40.   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
41.   at System.Windows.UIElement.Measure(Size availableSize)
42.   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
43.   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)
44.   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
45.   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
46.   at System.Windows.UIElement.Measure(Size availableSize)
47.   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
48.   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
49.   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
50.   at System.Windows.UIElement.Measure(Size availableSize)
51.   at System.Windows.ContextLayoutManager.UpdateLayout()
52.   at System.Windows.Controls.TabItem.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
53.   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
54.   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
55.   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
56.   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
57.   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
58.   at System.Windows.Input.InputManager.ProcessStagingArea()
59.   at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
60.   at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
61.   at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
62.   at System.Windows.UIElement.Focus()
63.   at System.Windows.Controls.TabItem.SetFocus()
64.   at System.Windows.Controls.TabItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
65.   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
66.   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
67.   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
68.   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
69.   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
70.   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
71.   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
72.   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
73.   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
74.   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
75.   at System.Windows.Input.InputManager.ProcessStagingArea()
76.   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
77.   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
78.   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
79.   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
80.   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
81.   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
82.   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
83.   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
84.   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
85.   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr...

Please, suggest a direction or a clue based on the stack trace which can lead me to the problem or it's solution?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Accepted
Vasiliy
Top achievements
Rank 1
answered on 11 Aug 2016, 08:22 AM
Explicitly setting the FilterMemberType to the GridViewDataColumn by which filtering is applied has solved the problem.
Tags
GridView
Asked by
Anatoliy
Top achievements
Rank 2
Answers by
Vasiliy
Top achievements
Rank 1
Share this question
or