-
Notifications
You must be signed in to change notification settings - Fork 357
Open
Labels
Description
ALinqExpressionVisitor fails to translate a Contains expression with .net10 rc1.
Assemblies affected
Microsoft.OData.Core 9.0.0-preview.2
Steps to Reproduce
Translating a query like this...
var ids = new string[] { "A", "B", "C" };
var query = from d in ctx.Something
where ids.Contains(d.ID)
select d;
query.ToList();
Expected behaviour
The query should be executed with the expression translated to an Uri like: /Something?$filter=ID in ('A','B','C')
Actual behaviour
An exception is thrown: System.NotSupportedException: 'Specified method is not supported.'
Message:
Test method WorkZone.OData4.Test.Integration.CustomTypes.UnProjectedIssue_SingleDropType threw exception:
System.NotSupportedException: Specified method is not supported.
Stack Trace:
RuntimeMethodInfo.ThrowNoInvokeException()
RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Delegate.DynamicInvokeImpl(Object[] args)
Delegate.DynamicInvoke(Object[] args)
SubtreeEvaluator.Evaluate(Expression e)
SubtreeEvaluator.Visit(Expression exp)
ALinqExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original)
ALinqExpressionVisitor.VisitMethodCall(MethodCallExpression m)
ALinqExpressionVisitor.Visit(Expression exp)
DataServiceALinqExpressionVisitor.Visit(Expression exp)
<16 more frames...>
Evaluator.PartialEval(Expression expression)
DataServiceQueryProvider.Translate(Expression e)
DataServiceQuery`1.Translate()
DataServiceQuery`1.Execute()
DataServiceQuery`1.GetEnumerator()
List`1.ctor(IEnumerable`1 collection)
Enumerable.ToList[TSource](IEnumerable`1 source)
Additional details
It worked with .net10 preview7. It also works on ODL 8 with .net8.