| Bug #119461 | MySql.EntityFrameworkCore error when using Linq with .Contains in fails | ||
|---|---|---|---|
| Submitted: | 25 Nov 2025 11:32 | Modified: | 27 Nov 2025 16:37 |
| Reporter: | James Britton | Email Updates: | |
| Status: | Open | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 10.0.0-rc | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[26 Nov 2025 1:03]
liming ma
hi I opened the fix PR. https://bugs.mysql.com/bug.php?id=119338
[27 Nov 2025 16:37]
James Britton
Hi, great, do you know if that will make it into a fixed version of the pre-release package? And then is the release of the v10 package likely to be coming in January like previous releases? Thankyou, James Britton
[10 Feb 20:31]
Jeremy Walsh
Any progress on this? I've also encountered this error and would like a fix.
[27 Apr 10:21]
Anson Woo
I am hitting the same wall
[29 Apr 10:42]
Torben Hørup
Bug still present with MySql.EntityFrameworkCore 10.0.1 & MySql.Data 9.7.0

Description: Been working on getting ready for .NET 10, but noticed that the 10.0.0-rc package seems to have issues when using .Where in Linq with .Contains call in predicate. How to repeat: 1. Create an empty API project/ 2. Add a BugDbContext that has a DbSet<FakeEntity> property. A fake entity should have an ID property and a name property. Register this DB context in the DI container. 4. Add a BugRepository class that consumes the BugDbContext from the DI container, and also has a public method called trigger that has the following implementation. And register it in the DI container as a scoped service. " public async Task Trigger() { await dbContext.FakeEntities.AddAsync(new FakeEntity { Name = "Fake Entity One" }); await dbContext.FakeEntities.AddAsync(new FakeEntity { Name = "Fake Entity Two" }); await dbContext.FakeEntities.AddAsync(new FakeEntity { Name = "Fake Entity Three" }); await dbContext.FakeEntities.AddAsync(new FakeEntity { Name = "Fake Entity Four" }); await dbContext.SaveChangesAsync(); string[] list = ["Fake Entity One", "Fake Entity Four"]; var result = await dbContext.FakeEntities.Where(x => list.Contains(x.Name)) .ToListAsync(); Console.WriteLine("Result of Query {Count} found", result.Count); } " 5. After builder.Build a class that gets the BugRepository from the DI container and calls the method trigger. You can do this like this. " var service = app.Services.GetRequiredService<BugRepository>(); await service.Trigger(); " 6. now if you run this web application you should see an error like this. "Unhandled exception. System.InvalidOperationException: Expression '@list' in the SQL tree does not have a type mapping assigned."