EF Core does not report types it failed to load from migration assemblies #19691
Labels
area-migrations
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
punted-for-7.0
Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints.
type-bug
Milestone
EntityFramework Core should report failed types from SharedTypeExtensions.GetLoadableDefinedTypes.
I just spent 6 hours figuring out why EntityFramework Core suddenly does not apply any pending migrations with context.Database.Migrate(). After exploring more I noticed that context.Database.GetMigrations() and context.Database.GetPendingMigrations() were empty. I checked IMigrationAssemlby which also had an empty Migrations property.
Finally, after testing and debugging more I noticed that GetLoadableDefinedTypes catches a TypeLoadException without reporting it here. This exception should be reported at least in the debug logs.
It seems like Microsoft.EntityFrameworkCore.Relational was missing for my migrations project for some reason, after adding it my migrations started to work again.
The text was updated successfully, but these errors were encountered: