-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Bug description
The code is intentionally simple, the ids could be conditionally selected.
Works fine in 8.
Your code
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using var db = new MyContext();
var ids = db.Items.Select(c => c.Id);
db.Items.Where(r => ids != null && ids.Contains(r.Id)).Load();
class MyContext : DbContext
{
public DbSet<Item> Items { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseSqlite("Data Source=triage.db")
.LogTo(Console.WriteLine, filter: (id, level) => id == RelationalEventId.CommandExecuting)
.EnableSensitiveDataLogging();
}
}
class Item
{
public int Id { get; set; }
public string? Name { get; set; }
}Stack traces
The LINQ expression 'DbSet<Item>()
.Where(i => DbSet<Item>()
.Select(i0 => i0.Id) != null && DbSet<Item>()
.Select(i1 => i1.Id)
.Contains(i.Id))' could not be translated.
Verbose output
EF Core version
9.0.1
Database provider
N/A
Target framework
net9.0
Operating system
N/A
IDE
N/A
Copilot