Exception using <arr>.Contains in query

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
powelerl
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Exception using <arr>.Contains in query

Post by powelerl » Tue 31 Oct 2017 14:39

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()

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception using <arr>.Contains in query

Post by Shalex » Wed 01 Nov 2017 14:54

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

powelerl
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: Exception using <arr>.Contains in query

Post by powelerl » Tue 14 Nov 2017 10:39

Do you know when I can expect a new release?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception using <arr>.Contains in query

Post by Shalex » Wed 15 Nov 2017 14:04

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.

astrix
Posts: 1
Joined: Wed 15 Nov 2017 10:08

Re: Exception using <arr>.Contains in query

Post by astrix » Wed 15 Nov 2017 22:43

We are also waiting for this fix, is it possible to get the internal build ?

powelerl
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: Exception using <arr>.Contains in query

Post by powelerl » Thu 16 Nov 2017 11:29

The internal build works fine, for both .NET Core and .NET Framework. Thanks!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception using <arr>.Contains in query

Post by Shalex » Thu 16 Nov 2017 13:26

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.

janidbest
Posts: 3
Joined: Mon 20 Nov 2017 05:58

Re: Exception using <arr>.Contains in query

Post by janidbest » Tue 21 Nov 2017 00:04

Same problem here, having this issue when using with .NET Core app.
Appreciate your help

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception using <arr>.Contains in query

Post by Shalex » Tue 21 Nov 2017 08:57

We are planning to release the new build of dotConnect for Oracle this week. We will notify you when it is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception using <arr>.Contains in query

Post by Shalex » Fri 24 Nov 2017 10:36

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.

Post Reply