Open fschwiet opened 1 day ago
Confirmed regression from 8.0 to 9.0; not specific to SQLite.
await using var context = new BlogContext();
await context.Database.EnsureDeletedAsync();
await context.Database.EnsureCreatedAsync();
ImmutableArray<string> tags = ["foo", "bar"];
// List<string> tags = ["foo", "bar"]; // This works
var existingEntities = await context
.Tags.Where(t => tags.Contains(t.Value))
.ToArrayAsync();
public class BlogContext : DbContext
{
public DbSet<Tag> Tags { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSqlServer("Server=localhost;Database=test;User=SA;Password=Abcd5678;Connect Timeout=60;ConnectRetryCount=0;Encrypt=false")
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging();
}
public class Tag
{
public int Id { get; set; }
public string Value { get; set; }
}
@cincuranet assigning to you as you worked in this area in 9.0, IIRC.
File a bug
I ran into a regression going from 8.0.1 to 9.0.0 using the Sqlite provider. I have some code which is checking if the string value of a column (column name Value) is one of a number of values (using dbKeys.Contains). dbKeys was an ImmutableArray, I found if I used an Array instead it start to work. But I don't see any reason it shouldn't keep working with an ImmutableArray.
Include your code
The following code using ToImmutableArray stopped working when going from 8.0.1 to 9.0.0:
But it works if I use ToArray():
Include stack traces
Include provider and version information
EF Core version: regressed with version 9.0.0, worked for version 8.0.1 Database provider: Microsoft.EntityFrameworkCore.Sqlite regressed with version 9.0.0, worked for version 8.0.1 Target framework: regression seen with net9.0, worked with net8.0 Operating system: Windows 11 Home IDE: JetBrains Rider 2024.2.5