efcore: Null Reference Exception when using HasData
I have a quite complex project, with a separate migrations assembly, modular asp.net (orchard) project, database seeding and owned types. I was able to generate migrations with ef core 2.2, but am not longer able to do it with ef core 3. First thing I tried, after making it compile, was doing a migration, and got this stack trace
System.NullReferenceException: Object reference not set to an instance of an object. at lambda_method(Closure , ValueBuffer ) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalShadowEntityEntry…ctor(IStateManager stateManager, IEntityType entityType, ValueBuffer& valueBuffer) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntryFactory.NewInternalEntityEntry(IStateManager stateManager, IEntityType entityType, Object entity, ValueBuffer& valueBuffer) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.CreateEntry(IDictionary`2 values, IEntityType entityType) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.TrackData(IModel source, IModel target) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.Diff(IModel source, IModel target, DiffContext diffContext) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationsModelDiffer.GetDifferences(IModel source, IModel target) at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace, String language) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) Object reference not set to an instance of an object.
The project is in this github repo
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (8 by maintainers)
Commits related to this issue
- Use Shadow property index when generating Shadow values buffer Shadow Values factory expects a value buffer which also has slots for shadow navigations. But when populating we did not consider them. ... — committed to dotnet/efcore by smitpatel 5 years ago
- Use Shadow property index when generating Shadow values buffer Shadow Values factory expects a value buffer which also has slots for shadow navigations. But when populating we did not consider them. ... — committed to dotnet/efcore by smitpatel 5 years ago
- Use Shadow property index when generating Shadow values buffer Shadow Values factory expects a value buffer which also has slots for shadow navigations. But when populating we did not consider them. ... — committed to dotnet/efcore by smitpatel 5 years ago
It went into v 3.1.0-preview2. Would be available in nightly builds.
@smitpatel Is there a workaround to get around this issue until your changes will be published?