You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a small detour/goose chase when I added a migration where I started getting the following error from the command line when creating migrations:
An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: Value cannot be null.
Parameter name: assembly
In spite of the error, migrations were created fine, and the database was able to be updated, but I couldn't figure out where the error was coming from. It turns out that I added AutoMapper to the project and added a call to services.AddAutoMapper() in ConfigureServices and neglected to pass in the assembly parameter (as the error alludes to).
Although I was able to figure this out, and perhaps AutoMapper should be more verbose in its own error, I think it was a little misleading for EF to suggest adding an IDbContextFactory in this case as a course of correction.
Steps to reproduce
Add AutoMapper to a project with EF Core.
Add the call to services.AddAutoMapper(); to ConfigureServices
Console.WriteLine("Hello World!");
Further technical details
EF Core version: CoreDesign 1.1.1, Tools 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Win10
IDE: Visual Studio 2017
The text was updated successfully, but these errors were encountered:
@MisterJames For 2.0, we have updated the message here to make it more apparent that the process continued and was able to use a different mechanism to get your context instance. Closing a duplicate of #9073. See also #9076.
I had a small detour/goose chase when I added a migration where I started getting the following error from the command line when creating migrations:
In spite of the error, migrations were created fine, and the database was able to be updated, but I couldn't figure out where the error was coming from. It turns out that I added AutoMapper to the project and added a call to
services.AddAutoMapper()
inConfigureServices
and neglected to pass in theassembly
parameter (as the error alludes to).Although I was able to figure this out, and perhaps AutoMapper should be more verbose in its own error, I think it was a little misleading for EF to suggest adding an
IDbContextFactory
in this case as a course of correction.Steps to reproduce
services.AddAutoMapper();
toConfigureServices
Further technical details
EF Core version: CoreDesign 1.1.1, Tools 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Win10
IDE: Visual Studio 2017
The text was updated successfully, but these errors were encountered: