Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'expr')

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'expr')

Hi Devart team, 

I am facing an issue in my .NET 7 application connecting to an Oracle Database using Devart.Data.Oracle.EF library. 

When I try to query the parent table that is configured using table-per-type (TPT) I got the next error: 

  1. Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'expr')
  2.    at Devart.Common.Entity.z.a(Object A_0, String A_1)
  3.    at Devart.Common.Entity.e.a(Expression A_0)
  4.    at Devart.Common.Entity.o.a(Expression A_0, DbExpressionKind[] A_1)
  5.    at Devart.Common.Entity.o.b(Expression A_0)
  6.    at Devart.Common.Entity.dw.a.b(Expression A_0)
  7.    at Devart.Common.Entity.dw.a.VisitCase(CaseExpression sourceExpr)
  8.    at Microsoft.EntityFrameworkCore.Query.SqlExpressionVisitor.VisitExtension(Expression extensionExpression)
  9.    at Devart.Common.Entity.y.VisitExtension(Expression extensionExpression)
  10.    at Devart.Common.Entity.y.f(SqlExpression A_0)
  11.    at Devart.Common.Entity.y.VisitProjection(ProjectionExpression projectionExpression)
  12.    at Devart.Common.Entity.dw.a.VisitProjection(ProjectionExpression sourceExpr)
  13.    at Devart.Common.Entity.y.a(ProjectionExpression A_0)
  14.    at System.Linq.Enumerable.SelectListIterator`2.ToList()
  15.    at Devart.Common.Entity.y.VisitSelect(SelectExpression selectExpression)
  16.    at Microsoft.EntityFrameworkCore.Query.SqlExpressionVisitor.VisitExtension(Expression extensionExpression)
  17.    at Devart.Common.Entity.y.VisitExtension(Expression extensionExpression)
  18.    at Devart.Common.Entity.dw.VisitExtension(Expression node)
  19.    at Devart.Data.Oracle.Entity.i.Process(Expression query)
  20.    at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
  21.    at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
  22.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
  23.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0()
  24.    at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
  25.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
  26.    at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
  27.    at Microsoft.EntityFrameworkCore.Internal.EntityFinder`1.Find(Object[] keyValues)
  28.    at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.Find(Object[] keyValues)
  29.    at Program.<Main>$(String[] args) in C:\dev\CA-Microservices-DotNet\Devart-NullReference-Issue-PoC\Devart-NullReference-Issue-PoC\Program.cs:line 9

I am using the latest version of Devart.Data.Oracle.EFCore 10.2.0.7  and EntityFrameworkCore 7.0.10. 

I have created a small test project so you can take a look to the issue, hopefully it helps. 

Thanks in advance, regards!

Database Script for the test project:

 -- Create the 'People' table

CREATE TABLE PEOPLE (

ID NUMBER(11) GENERATED ALWAYS AS IDENTITY PRIMARY KEY,

FULL_NAME NVARCHAR2(255) NOT NULL

);


-- Create the 'Students' table

CREATE TABLE STUDENTS (

ID NUMBER(11) NOT NULL,

ENROLLMENT_DATE DATE NOT NULL,

CONSTRAINT PK_STUDENTS PRIMARY KEY (ID),

CONSTRAINT FK_STUDENTS_PEOPLE_ID FOREIGN KEY (ID) REFERENCES PEOPLE(ID)

);


-- Create the 'Teachers' table

CREATE TABLE TEACHERS (

ID NUMBER(11) NOT NULL,

HIRE_DATE DATE NOT NULL,

CONSTRAINT PK_TEACHERS PRIMARY KEY (ID),

CONSTRAINT FK_TEACHERS_PEOPLE_ID FOREIGN KEY (ID) REFERENCES PEOPLE(ID)

);