[英]Add-Migration Value cannot be null. Parameter name: language
I am trying to create a new migration but I get an System.ArgumentNullException saying:我正在尝试创建一个新的迁移,但我收到 System.ArgumentNullException 说:
System.ArgumentNullException: Value cannot be null.
Parameter name: language
at Microsoft.EntityFrameworkCore.Utilities.Check.NotNull[T](T value,
String parameterName)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor
(IOperationReporter reporter, Assembly assembly, Assembly
startupAssembly, String projectDir, String rootNamespace, String
language)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ct
or>b__4()
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Value cannot be null.
Parameter name: language
It's related to the EF Core not EF6, it looks like there is a bug in the 2.1.0.preview1-final version. 它与EF Core而不是EF6有关,看起来2.1.0.preview1-final版本中存在一个错误。
- Check the version you are running with dotnet ef --version
使用dotnet ef --version检查您运行的版本
- Downgrade to the Microsoft.EntityFrameworkCore.Design 2.0.1 version.
降级到Microsoft.EntityFrameworkCore.Design 2.0.1版本。
I think this is a bug.我认为这是一个错误。
I'm using EF Core 2.2.4, i'm trying to rollback a migration with:我正在使用 EF Core 2.2.4,我正在尝试回滚迁移:
migrationBuilder.DropIndex(name: "myIndexName");
This was auto-generated for me by EF.这是 EF 为我自动生成的。
The method signature says name is the only required parameter (there's 2 optional ones after).方法签名说 name 是唯一必需的参数(后面有 2 个可选参数)。 When i run this i get this:
当我运行这个我得到这个:
System.ArgumentNullException: Value cannot be null.
Parameter name: name
but if i add a second parameter for the table name it works:但如果我为表名添加第二个参数,它会起作用:
migrationBuilder.DropIndex(
name: "myIndexName",
table: "myTableName");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.