Filtering on String Field with EntityFramework Backend Creates Error (RemoveDidactics)
I am seeing an error when sorting on a column of type string:
https://i.imgur.com/ZFYMQA0.gif
When this happens, an error is thrown:
```
System.InvalidOperationException: The LINQ expression 'DbSet<Transaction>()
.OrderByDescending(t => t.Created)
.Join(
inner: DbSet<Account>(),
outerKeySelector: t => EF.Property<Guid?>(t, "AccountId"),
innerKeySelector: a => EF.Property<Guid?>(a, "Id"),
resultSelector: (o, i) => new TransparentIdentifier<Transaction, Account>(
Outer = o,
Inner = i
))
.LeftJoin(
inner: DbSet<User>(),
outerKeySelector: t => EF.Property<int?>((UserOwnedAccount)t.Inner, "OwnerId"),
innerKeySelector: u => EF.Property<int?>(u, "Id"),
resultSelector: (o, i) => new TransparentIdentifier<TransparentIdentifier<Transaction, Account>, User>(
Outer = o,
Inner = i
))
.Where(t => (long)t.Inner.Id == __p_0)
.Where(t => (t.Outer.Inner is UserOwnedAccount) ? (t.Outer.Inner is StandardUserAccount) ? ((StandardUserAccount)t.Outer.Inner).Name : t.Outer.Inner.Id.ToString() : (t.Outer.Inner is SystemAccount) ? ((SystemAccount)t.Outer.Inner).Name : t.Outer.Inner.Id.ToString()
.RemoveDiacritics() == "018BAC27-A038-41FE-13A6-08DDD370DEB9")' could not be translated. Additional information: Translation of method 'Syncfusion.Blazor.Data.QueryableExtensions.RemoveDiacritics' failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Expression Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.Translate(Expression expression)
```
It seems to be having an issue with `.RemoveDiacritics()` which did not occur in previous versions of Syncfusion.Blazor. Can you confirm that this scenario is known and tested with data sources using Entity Framework as the backend?
I can confirm that this did not occur with previous versions of Syncfusion.Blazor.
Thank you for any assistance you can provide.
Hi Mike-E,
We have made a sample with URL adaptor binding the data from the SQL and ensured the mentioned scenario from our end, however we could not able to replicate the mentioned issue from our end. We have attached the sample ensured from our end please check.
Before proceeding with the reported requirement, we require some additional clarification from your end. Please share the below details to proceed further at our end.
- Please provide a simple issue replicating sample or try to modify the above-mentioned sample.
- Share us the video demonstration of the reported issue.
- Please provide the NuGet version in which the issue is getting reproduced from your end and the version which works fine.
The above requested detail will be very helpful for us to validate the reported issue at our end.
Regards,
Sanjay Kumar Suresh
Attachment: Blazor_Web_app_ab82061f.zip
Hi Sanjay,
Thank you very much for your investigation and for taking the time to build a solution around this. I did look into the solution and saw that it is MS-SQL and not EntityFramework as I have described. Additionally, it seems this uses an APIController, and my Blazor solution does not use an api controller but binds directly to the IQueryable from EntityFramework DbSet.
I unfortunately cannot make a simple solution but if you can modify your solution to use EntityFramework (or utilize one that already does) I could work with this to see if I can reproduce it (if it does not readily reproduce once EntityFramework is introduced)
For the video, I provided one in the original post. Please confirm.
Finally, for the version. I unfortunately have not been able to test this particular part of my application due to a huge rewrite. The last I have seen this work is in my deployed code in production which is using 27.x.
Again I believe that the issue is the `RemoveDiacritics` call. EntityFramework cannot call this unless it can be translated to a SQL command. I believe once you introduce EntityFramework into your sample you will find you will encounter the same error.
Hi Mike-E,
As per your request, we’ve created a simple sample using Entity Framework and validated the mentioned scenario from our end. We were unable to reproduce the reported issue in our environment.
To assist further, we kindly request you to review the attached sample and make any necessary changes that would help replicate the issue. Additionally, please ensure that you update the connection string inside the OrderContext.cs file to match your local database configuration.
Regards,
Sanjay Kumar Suresh
Attachment: BlazorGrid_Server_1_b65630b2.zip
Hi Sanjay,
Thank you very much for the sample, it is appreciated. I did take a look into it, and the first difference I noticed is that I am using a custom adaptor. I tried converting to a custom adaptor but ran into a problem when displaying the filter:
In the code I see 800+ names:
Is there a reason why this is not showing? I will attach the code for your review.
Attachment: BlazorGrid_Server_6032d4eb.zip
Hi Mike-E,
In the attached sample, it appears that the SELECT query has been used redundantly, which may have contributed to the reported issue. We’d like to inform you that this scenario was addressed in our recent update. We also attempted to replicate the issue based on your description, but were unable to reproduce it on our end.
Code Snippet:
|
async Task OnRequest(DataRequestResult parameter) { var context = new OrderContext(); IEnumerable items = parameter.Request.Take > 0 ? await context.Orders.Take(parameter.Request.Take).ToListAsync() : await context.Orders.ToListAsync(); parameter.Execute(items); } …. public override async Task<object> ReadAsync(DataManagerRequest request, string? key = null) { var result = new DataRequestResult(request, key); await Requested.InvokeAsync(result).ConfigureAwait(false);
IEnumerable<Order> items = result.Get() as IEnumerable<Order>;
// ✅ Add filtering logic if (request.Where != null && request.Where.Count > 0) { items = DataOperations.PerformFiltering(items, request.Where, request.Where[0].Operator); }
return request.RequiresCounts ? new DataResult() { Result = items, Count = 830 } : (object)items; } |
To assist further, we kindly request you to review the attached sample and make any necessary modifications that would help us reproduce the issue reliably.
Regards,
Sanjay Kumar Suresh
Attachment: BlazorGrid_Server_6032d4eb_506067ec.7z
Hi Sanjay,
Thank you very much again for your time, patience, and assistance in helping me track this down. I am glad to say that I have finally reproduced this for your review. Please run the solution, filter on an OrderView.Name, and observe the exception caught at BlazorGrid_Server/Components/Pages/DataRequestCallbackAdaptor.razor:32
Please let me know if any further information is required and I will assist you.
Thank you,
Michael
Attachment: BlazorGrid_Server_cbdcaf6c.zip
Hi Mike-E,
Greetings from Syncfusion,
We have confirmed that this is an issue and logged a defect report titled “Console error throws while filtering the string column on Datagrid binded with Entity Framework” This fix will be included in our Main release volume 3 2025. You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”
We will get back to you once the release is rolled out. Until then we appreciate your patience.
Regards,
Sanjay Kumar Suresh
Awesome! Thank you so very much Sanjay and team. 🙏🙏🙏
Hi Mike-E,
Thanks for your patience.
We are glad to announce that, we have included the fix for the “Console error throws while filtering the string column on Datagrid binded with Entity Framework” in our “30.2.7” release. So please upgrade to our latest version of Syncfusion NuGet package to resolve the reported issue. Please find the NuGet package for latest fixes and features from below.
NuGet: https://www.nuget.org/packages/Syncfusion.Blazor.Grid
Root Cause:
Although IgnoreAccent was explicitly set to false in the DataGrid, it continued to evaluate as true. This led to redundant if conditions being triggered, ultimately causing the reported exception.
Corrective Actions Taken:
To resolve the issue, the IgnoreAccent value is now reassigned dynamically from Grid.FilterSettings.IgnoreAccent instead of being hardcoded. This ensures consistent behavior and prevents the exception.
Regards,
Sanjay Kumar Suresh
- 9 Replies
- 2 Participants
-
MI Mike-E
- Aug 4, 2025 04:38 PM UTC
- Aug 26, 2025 06:00 AM UTC