You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've had another integration test failing that worked before in EF Core 7. In SQLite, we're getting an error for a missing column SQLite Error 1: 'no such column: p2.value', whereas SQL Server reports The multi-part identifier "p2.value" could not be bound.. I've put the full exception messages for both databases further down in code blocks.
For SQL Server, we can reproduce it both on Windows via LocalDB and on Linux via SQL Server in Docker (both DB and the EF Core process running on Linux), SQLite was only tested locally in Windows.
Include your code
Below, I've attached the full code required for reproduction, both in SQLite and SQL Server. I've been running with .NET 8 and EF Core 8.0.0. I've verified that the exact same code runs in .NET 7 with EF Core 7.0.0.
usingMicrosoft.EntityFrameworkCore;usingMicrosoft.Extensions.DependencyInjection;namespaceEfCoreTest{internalclassProgram{privatestaticasyncTaskMain(string[]args){Console.WriteLine("Checking SQLite");awaitSetupAndReproErrorAsync(options =>options.UseSqlite("Data Source=data.db"));Console.WriteLine("Checking SQL Server");awaitSetupAndReproErrorAsync(options =>options.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=EfCoreRepro;Trusted_Connection=True;MultipleActiveResultSets=true"));}privatestaticasyncTaskSetupAndReproErrorAsync(Action<DbContextOptionsBuilder>setup){varserviceCollection=newServiceCollection();serviceCollection.AddDbContext<ReproDbContext>(setup);varservices=serviceCollection.BuildServiceProvider();// Create a databaseusing(varscope=services.CreateScope()){vardbContext=scope.ServiceProvider.GetRequiredService<ReproDbContext>();awaitdbContext.Database.EnsureDeletedAsync();awaitdbContext.Database.EnsureCreatedAsync();}// Run the repro that throws the exceptionusing(varscope=services.CreateScope()){vardbContext=scope.ServiceProvider.GetRequiredService<ReproDbContext>();try{awaitReproDatabaseError(dbContext);}catch(Exceptione){Console.WriteLine(e);}}}privatestaticasyncTaskReproDatabaseError(ReproDbContextcontext){varpositionIdsWithoutTotalPrice=new[]{Guid.NewGuid()};varprojectProductsQuery=fromrawDatain(fromcalculationRowincontext.CalculationRows
join calculationincontext.Calculations
on calculationRow.CalculationId equals calculation.Idwhere!positionIdsWithoutTotalPrice.Contains(calculation.Id)selectnew{calculationRow.MasterProductId,calculation.Id,calculation.Name})
group rawData by rawData.MasterProductId
into groupsselectnew{groups.FirstOrDefault().MasterProductId,groups.FirstOrDefault().Name,};varcanMaterializeLikeThis=awaitprojectProductsQuery.ToListAsync();awaitprojectProductsQuery.OrderBy(p =>p.Name).ToListAsync();}}publicclassReproDbContext:DbContext{publicReproDbContext(DbContextOptions<ReproDbContext>options):base(options){}publicDbSet<CalculationRow>CalculationRows{get;set;}publicDbSet<Calculation>Calculations{get;set;}}publicclassCalculation{publicGuidId{get;set;}publicstringName{get;set;}publicList<CalculationRow>Rows{get;set;}}publicclassCalculationRow{publicGuidId{get;set;}publicGuidCalculationId{get;set;}publicCalculationCalculation{get;set;}publicGuidMasterProductId{get;set;}}}
Include stack traces
Running the code above, I'm getting exceptions both for SQLite and SQL Server. I did not try any other databases.
SQLite
Checking SQLite
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: p2.value'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at EfCoreTest.Program.ReproDatabaseError(ReproDbContext context) in C:\Users\Georg\Downloads\EfCoreTest\EfCoreTest\Program.cs:line 67
at EfCoreTest.Program.SetupAndReproErrorAsync(Action`1 setup) in C:\Users\Georg\Downloads\EfCoreTest\EfCoreTest\Program.cs:line 36
SQL Server
Checking SQL Server
Microsoft.Data.SqlClient.SqlException (0x80131904): The multi-part identifier "p2.value" could not be bound.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__209_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at EfCoreTest.Program.ReproDatabaseError(ReproDbContext context) in C:\Users\Georg\Downloads\EfCoreTest\EfCoreTest\Program.cs:line 67
at EfCoreTest.Program.SetupAndReproErrorAsync(Action`1 setup) in C:\Users\Georg\Downloads\EfCoreTest\EfCoreTest\Program.cs:line 36
ClientConnectionId:dc20f370-a18d-4005-968c-094b1c8406fd
Error Number:4104,State:1,Class:16
Include provider and version information
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 8
Operating system: Windows 10
IDE: Visual Studio 2022 17.8.0
The text was updated successfully, but these errors were encountered:
We've had another integration test failing that worked before in EF Core 7. In SQLite, we're getting an error for a missing column
SQLite Error 1: 'no such column: p2.value'
, whereas SQL Server reportsThe multi-part identifier "p2.value" could not be bound.
. I've put the full exception messages for both databases further down in code blocks.For SQL Server, we can reproduce it both on Windows via LocalDB and on Linux via SQL Server in Docker (both DB and the EF Core process running on Linux), SQLite was only tested locally in Windows.
Include your code
Below, I've attached the full code required for reproduction, both in SQLite and SQL Server. I've been running with .NET 8 and EF Core 8.0.0. I've verified that the exact same code runs in .NET 7 with EF Core 7.0.0.
Include stack traces
Running the code above, I'm getting exceptions both for SQLite and SQL Server. I did not try any other databases.
SQLite
SQL Server
Include provider and version information
EF Core version:
Database provider:
Microsoft.EntityFrameworkCore.SqlServer
andMicrosoft.EntityFrameworkCore.Sqlite
Target framework:
.NET 8
Operating system:
Windows 10
IDE:
Visual Studio 2022 17.8.0
The text was updated successfully, but these errors were encountered: