New to Telerik UI for WPF? Download free 30-day trial

StackOverflowException on selecting all distinct values

The StackOverflowException is thrown by the .NET Framework. When you "Select All" a LINQ query is built in order to filters. The LINQ query looks something like this:

var result = sourceCollection.Where(myObject => myObject.ID == 0 || myObject.ID == 1 || ... || myObject.ID = n);

where n is the number of distinct values shown in the filter dialog. When there are more than n distinct values this expression becomes so enourmous that the .NET Framework cannot handle it and it throws exception. The only way to work around this limitation of the .NET Platform would be to limit your distinct values to n or less like explained in this help article

You should either decrease the number of distinct values shown or turn them off altogether by setting ShowDistinctFilters of the column to false.

In this article