HI, After upgrading to Radzen 6.0.6, I encountered an issue when executing queries with dynamic filtering. Previously, the following code worked correctly: items = items.Where(query.Filter, query.FilterParameters);
However, after updating, I get the following error: System.InvalidOperationException: Invalid Where selector
Here my code: protected override async Task OnInitializedAsync()
{
...
var filters = new List();
var filterParameters = new List();
int parmIdx = 0;
Could you please confirm if there was a breaking change in Radzen 6.0.6 regarding dynamic filtering? If so, what would be the recommended way to adjust our queries to work with the new version?
I also got massive issues after upgrading to 6.0; I had to revert to 5. The problem is also that the error message above does not really help. There is no real way to debug what the problem with the query is. Just try&error which is not an option for more complex queries (most of them were generated initially with Radzen Studio btw).
Is there any way to find out more why the queries are not working? I also got the impression that the use if C# inside query with expressions like .Contains() or .ToString() cause massive problems....
Would be great to understand what has actually changed.
The change is triggered by the System.Dynamic.Linq.Core library vulnerability. We do not want to rely on vulnerable dependency. The string expression used for Where() and Select() methods were not valid C# in some cases but pseudo syntax applicable for System.Dynamic.Linq.Core library only - our Where() and Select() methods by strings will accept only valid C# strings since we are using Microsoft Roslyn to parse it runtime.
Ok, understood. However, it would be a huge help if the exception could contain more detailed information what in the parsed string exactly is the problem. This generinc error makes it very hard if not impossible to find the actual issue with a given query.
you got the right point. After prefixing the names with "i." it works as expected. I really need to go through all the expressions in my app since these have been initially been created using Radzen Studio. But with the new, more detailed exception and the syntax changes for the filter expressions in mind, it should be possible to get everything fixed.
Exception caught: 'System.NotSupportedException' in BlazorEcommerce.ServerTest.dll ("MemberInit") Exception caught: 'System.NotSupportedException' in BlazorEcommerce.ServerTest.dll ("MemberInit") Hyperlink: Activate Historical Debugging giving error on var list = filteredSums.ToList();
Thank you for ansver. Radzendatagrid Loaddata Query working at 5.9.9. but after version 6.0.. Exception caught: 'System.NotSupportedException' in BlazorEcommerce.ServerTest.dll ("MemberInit") Hyperlink: Activate Historical Debugging giving error on var list = filteredSums.ToList();
When I filter using the "contains" option for a given string, I get this exception:
System.ArgumentException: Argument types do not match
at System.Linq.Expressions.Expression.Constant(Object value, Type type)
at Radzen.QueryableExtension.GetExpression[T](ParameterExpression parameter, FilterDescriptor filter, FilterCaseSensitivity filterCaseSensitivity, Type type)
at Radzen.QueryableExtension.Where[T](IQueryable`1 source, IEnumerable`1 filters, LogicalFilterOperator logicalFilterOperator, FilterCaseSensitivity filterCaseSensitivity)
at Radzen.QueryableExtension.Where[T](IQueryable`1 source, IEnumerable`1 columns)
at Radzen.Blazor.RadzenDataGrid`1.get_View()
at Radzen.PagedDataBoundComponent`1.get_PagedView()
at Radzen.Blazor.RadzenDataGrid`1.DrawGroupOrDataRows(RenderTreeBuilder builder, IList`1 visibleColumns)
at Radzen.Blazor.RadzenDataGrid`1.<>c__DisplayClass22_0.<DrawRows>b__0(RenderTreeBuilder builder)
I think the problem here is that FilterProperty is "Contact.Company", so a sub-property.