Page 1 of 1

Exception using <arr>.Contains in query

Posted: Tue 31 Oct 2017 14:39
by powelerl
v9.5 NuGet - happens for both net47 and netcoreapp2.0

Code: Select all

Where(c => capabilityNames.Contains(c.CapabilityName))
capabilityNames is a plain string array. This code worked fine in v9.4.

Code: Select all

System.InvalidCastException occurred
  HResult=0x80004002
  Message=Unable to cast object of type 'Devart.Common.Entity.v' to type 'Microsoft.EntityFrameworkCore.Query.Expressions.AliasExpression'.
  Source=Devart.Data.Oracle.Entity.EFCore
  StackTrace:
   at System.Data.Common.CommandTrees.a.b(InExpression A_0)
   at System.Data.Common.CommandTrees.a.Visit(Expression node)
   at System.Data.Common.CommandTrees.a.f(SelectExpression A_0)
   at System.Data.Common.CommandTrees.b.d(SelectExpression A_0)
   at System.Data.Common.CommandTrees.a.e(SelectExpression A_0)
   at System.Data.Common.CommandTrees.a.Visit(Expression node)
   at System.Linq.Expressions.ExpressionVisitor.VisitAndConvert[T](T node, String callerName)
   at Devart.Data.Oracle.Entity.be.a(SelectExpression A_0)
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalExpressionPrinter.CommandBuilderPrinter.TryPrintConstant(ConstantExpression constantExpression, IndentedStringBuilder stringBuilder, Boolean removeFormatting)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.VisitConstant(ConstantExpression constantExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.VisitLambda[T](Expression`1 lambdaExpression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.Visit(Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.PrintInternal(Expression expression, Boolean removeFormatting, Nullable`1 characterLimit, Boolean highlightNonreducibleNodes)
   at Microsoft.EntityFrameworkCore.Query.Internal.ExpressionPrinter.Print(Expression expression, Boolean removeFormatting, Nullable`1 characterLimit)
   at Microsoft.EntityFrameworkCore.Internal.CoreLoggerExtensions.QueryExecutionPlanned(IDiagnosticsLogger`1 diagnostics, IExpressionPrinter expressionPrinter, Expression queryExecutorExpression)
   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateExecutorLambda[TResults]()
   at Microsoft.EntityFrameworkCore.Query.EntityQueryModelVisitor.CreateQueryExecutor[TResult](QueryModel queryModel)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](Expression query, INodeTypeProvider nodeTypeProvider, IDatabase database, IDiagnosticsLogger`1 logger, Type contextType)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass15_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Remotion.Linq.QueryableBase`1.GetEnumerator()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Powel.ManagedMetalayer.NetbasIntegration.NetbasMetalayerMetadata.<>c__DisplayClass76_0.<Load>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Re: Exception using <arr>.Contains in query

Posted: Wed 01 Nov 2017 14:54
by Shalex
Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Re: Exception using <arr>.Contains in query

Posted: Tue 14 Nov 2017 10:39
by powelerl
Do you know when I can expect a new release?

Re: Exception using <arr>.Contains in query

Posted: Wed 15 Nov 2017 14:04
by Shalex
We are planning to release the new public build next week. We have just sent the internal build with the fix to the email specified in your forum profile.

Re: Exception using <arr>.Contains in query

Posted: Wed 15 Nov 2017 22:43
by astrix
We are also waiting for this fix, is it possible to get the internal build ?

Re: Exception using <arr>.Contains in query

Posted: Thu 16 Nov 2017 11:29
by powelerl
The internal build works fine, for both .NET Core and .NET Framework. Thanks!

Re: Exception using <arr>.Contains in query

Posted: Thu 16 Nov 2017 13:26
by Shalex
astrix wrote:We are also waiting for this fix, is it possible to get the internal build ?
We have just sent the NuGet packages with the fix to the email specified in your forum profile.
powelerl wrote:The internal build works fine, for both .NET Core and .NET Framework. Thanks!
Thank you for letting us know.

Re: Exception using <arr>.Contains in query

Posted: Tue 21 Nov 2017 00:04
by janidbest
Same problem here, having this issue when using with .NET Core app.
Appreciate your help

Re: Exception using <arr>.Contains in query

Posted: Tue 21 Nov 2017 08:57
by Shalex
We are planning to release the new build of dotConnect for Oracle this week. We will notify you when it is available for download.

Re: Exception using <arr>.Contains in query

Posted: Fri 24 Nov 2017 10:36
by Shalex
The bug with using collections in a .Contains() method in EF Core 2 is fixed in the new (9.5.399) build: viewtopic.php?f=1&t=36257.