![](/img/trans.png)
[英]Add-Migration exception: System.ArgumentNullException: Value cannot be null. Parameter name: property
[英]Add-Migration Value cannot be null. Parameter name: language
我正在嘗試創建一個新的遷移,但我收到 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
這是問題#11075 。 您的工具版本與運行時版本不匹配。 確保已將每個Microsoft.EntityFrameworkCore包更新到2.1.0-preview1-final。
它與EF Core而不是EF6有關,看起來2.1.0.preview1-final版本中存在一個錯誤。
- 使用dotnet ef --version檢查您運行的版本
- 降級到Microsoft.EntityFrameworkCore.Design 2.0.1版本。
我認為這是一個錯誤。
我正在使用 EF Core 2.2.4,我正在嘗試回滾遷移:
migrationBuilder.DropIndex(name: "myIndexName");
這是 EF 為我自動生成的。
方法簽名說 name 是唯一必需的參數(后面有 2 個可選參數)。 當我運行這個我得到這個:
System.ArgumentNullException: Value cannot be null.
Parameter name: name
但如果我為表名添加第二個參數,它會起作用:
migrationBuilder.DropIndex(
name: "myIndexName",
table: "myTableName");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.