Completed
Last Updated: 22 Oct 2026 06:15 by ADMIN
Release 2026 Q4 (Nov)
Thomas
Created on: 21 Oct 2026 09:00
Category: DataSource
Type: Bug Report
0
2026.3.1015 regression: ToDataSourceResult default sort picks [NotMapped] properties and replaces the query's OrderBy (EF Core)
Description:
After upgrading Telerik.UI.for.AspNet.Core from 2026.3.811 to 2026.3.1015, ToDataSourceResult and
ToDataSourceResultAsync behave differently over Entity Framework Core queries when the
DataSourceRequest contains no sorts. That is the request a DropDownList or Grid sends when no sort is
configured ("sort=&group=&filter="). This change is not in the 2026.3.1015 release notes.

In 2026.3.1015 the method appends OrderBy(<first primitive property of the element type, in
declaration order>). In 2026.3.811 it adds no sort, and the query's own ordering is kept. This causes
two problems.

ISSUE 1: The default sort can pick a property EF Core cannot translate.
The chosen property is not checked against the EF model. If the first declared property is
[NotMapped], or is get-only with no backing column, the query fails:

  System.InvalidOperationException: The LINQ expression 'DbSet<Customer>()
      .OrderBy(c => c.Name)
      .OrderBy(c => c.Id)' could not be translated. Additional information: Translation of member
  'Id' on entity type 'Customer' failed. This commonly occurs when the specified member is unmapped.

This is a common pattern: a convenience "Id" property that maps to the real key (for example
"[NotMapped] public int Id => CustomerId;"). In our application, every dropdown read over an entity
shaped like this returns HTTP 500 after the upgrade.

ISSUE 2: The default sort replaces the caller's ordering.
The default sort is applied as OrderBy, not ThenBy. An ordering the caller already applied to the
IQueryable is thrown away. db.Products.OrderBy(p => p.Name).ToDataSourceResultAsync(request) now
returns rows in primary-key order (SQL: ORDER BY "ProductId"), not by Name. Applying an OrderBy
before calling ToDataSourceResult therefore no longer controls the order, so it is not a workaround.

ENVIRONMENT
- .NET 10, ASP.NET Core 10
- Microsoft.EntityFrameworkCore 10.0.12 (reproduced with SQL Server and with SQLite)
- Telerik.UI.for.AspNet.Core 2026.3.811 (works) vs 2026.3.1015 (fails)

STEPS TO REPRODUCE
The attached TelerikNotMappedSortRepro.zip is a self-contained console app: EF Core with an in-memory
SQLite database, no server, three files.
1. dotnet run
   (uses 2026.3.1015)
2. Delete obj/ and bin/, then: dotnet run -p:KendoVersion=2026.3.811

ACTUAL (2026.3.1015)
- Issue 1: InvalidOperationException, shown above
- Issue 2: Banana, Cherry, Apple (ORDER BY "ProductId")

EXPECTED (and the result with 2026.3.811)
- Issue 1: Apple, Banana, Cherry (ORDER BY "Name")
- Issue 2: Apple, Banana, Cherry (ORDER BY "Name")

SUGGESTED FIX
- When choosing a default sort column for an EF query, use only properties EF maps (for example, the
  entity's primary key from the EF model), never [NotMapped] or get-only co
- Do not replace an ordering already on the query. Use ThenBy, or skip the default sort when the
  expression already contains an OrderBy.

QUESTIONS
1. What changed between 2026.3.811 and 2026.3.1015 that makes this default sort apply to EF Core
   queries now?
2. Is there a supported way to turn the default sort off, or to choose its
   explicit Sort to every DataSource on the client? We have many endpoints
   ordering.
3. Is a fix planned, and in which release?
1 comment
ADMIN
Aleksandar
Posted on: 21 Oct 2026 10:16

Hello Thomas,

The reported behavior is indeed a bug.

As a workaround I can suggest ensuring that the DataSourceRequest has at least one sort descriptor:

 

var request = dsRequest;
if (request.Sorts == null || !request.Sorts.Any())
{
    request.Sorts = new List<SortDescriptor>
    {
        new SortDescriptor("Name", Kendo.Mvc.ListSortDirection.Ascending)
    };
}

var result = await db.Customers.ToDataSourceResultAsync(request);

 

For scenarios where there is no default sorting you can create a temporary extension method that would apply sorting, for example:

 

using Kendo.Mvc;
using Kendo.Mvc.UI;

public static class DataSourceRequestWorkaroundExtensions
{
    public static DataSourceRequest WithDefaultSort(
        this DataSourceRequest request,
        string member,
        ListSortDirection direction = ListSortDirection.Ascending)
    {
        if (request.Sorts == null || request.Sorts.Count == 0)
        {
            request.Sorts = new List<SortDescriptor> { new SortDescriptor(member, direction) };
        }

        return request;
    }
}

 

And than use it when calling the ToDataSourceResult/ToDataSourceResultAsync methods

 

var result = await db.Customers.ToDataSourceResultAsync(request.WithDefaultSort(nameof(Customer.Name)));

 

Alternatively, if you do not want to modify the actual action methods you can create a custom attribute that would apply the default sort:

 

using Microsoft.AspNetCore.Mvc.Filters;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public sealed class DefaultDataSourceSortAttribute : ActionFilterAttribute
{
    private readonly string member;

    public DefaultDataSourceSortAttribute(string member) => this.member = member;

    public bool Descending { get; set; }

    public override void OnActionExecuting(ActionExecutingContext context)
    {
        var direction = Descending ? ListSortDirection.Descending : ListSortDirection.Ascending;

        foreach (var request in context.ActionArguments.Values.OfType<DataSourceRequest>())
        {
            request.WithDefaultSort(member, direction);
        }
    }
}

 

And apply it to the action methods:

 

[DefaultDataSourceSort(nameof(Customer.Name))]
public async Task<IActionResult> Customers_Read([DataSourceRequest] DataSourceRequest request)
    => Json(await db.Customers.ToDataSourceResultAsync(request));

 

A fix for the reported bug is currently being reviewed and tested. You can monitor this item and update to the next version once the item is closed.

Feel free to get back to us in case you have any additional questions.

Regards,
Aleksandar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.