-
-
Notifications
You must be signed in to change notification settings - Fork 194
Description
Summary
When using TickerQ.EntityFrameworkCore with MySql.EntityFrameworkCore (EF Core 10), app startup crashes in UseTickerQ() with:
System.InvalidOperationException: Expression '@allRegisteredFunctions' in the SQL tree does not have a type mapping assigned.
This appears to come from the new orphaned cron cleanup query in:
src/TickerQ.EntityFrameworkCore/Infrastructure/BasePersistenceProvider.cs (around line 256 in commit 898f713be5a9414b1f72416b85b69f0a873d1322).
Environment
- TickerQ:
10.1.1 - TickerQ.EntityFrameworkCore:
10.1.1 - .NET:
10.0 - EF Core:
10.0.3 - Provider:
MySql.EntityFrameworkCore 10.0.1 - MySQL server:
9.5
Stack trace (top)
Unhandled exception. System.InvalidOperationException: Expression '@allRegisteredFunctions' in the SQL tree does not have a type mapping assigned.
at Microsoft.EntityFrameworkCore.Query.RelationalTypeMappingPostprocessor.VisitExtension(Expression expression)
...
at TickerQ.EntityFrameworkCore.Infrastructure.BasePersistenceProvider`3.MigrateDefinedCronTickers(...)
at TickerQ.DependencyInjection.TickerQServiceExtensions.SeedDefinedCronTickers(...)
at TickerQ.DependencyInjection.TickerQServiceExtensions.UseTickerQ(...)
Reproduction
- Create an ASP.NET Core app using TickerQ + TickerQ.EntityFrameworkCore.
- Configure MySQL provider (
UseMySQL(...)). - Register TickerQ operational store with application DbContext.
- Call
app.UseTickerQ(). - Startup fails before app is healthy.
Suspected cause
In MigrateDefinedCronTickers, this query appears to fail translation/type mapping for MySQL provider:
var allRegisteredFunctions = TickerFunctionProvider.TickerFunctions.Keys
.ToHashSet(StringComparer.Ordinal);
var orphanedCron = await cronSet
.Where(c => !allRegisteredFunctions.Contains(c.Function))
.Select(c => c.Id)
.ToArrayAsync(cancellationToken);HashSet<string> with comparer seems to get parameterized as @allRegisteredFunctions and the provider cannot assign type mapping.
Temporary workaround
Calling options.IgnoreSeedDefinedCronTickers() avoids this startup path and the service runs, but that disables auto-seeding/migration of code-defined cron tickers.
Suggested fix ideas
- Avoid
HashSet<string>in the query predicate (e.g., use array/list materialization that translates toIN (...)for providers). - Or force provider-safe constant expansion for that query.
- Add regression test for MySQL provider startup with
SeedDefinedCronTickersenabled.
Thanks for the great project — happy to test a patched build if you publish one.