Update-Database error: Value cannot be null. Parameter name: value

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
mikep
Posts: 4
Joined: Wed 22 Aug 2018 11:11

Update-Database error: Value cannot be null. Parameter name: value

Post by mikep » Wed 22 Aug 2018 11:38

I am just starting with dotConnect for Oracle, and would like to use it for Code First Migrations. When I run Update-Database (or Script-Migration), I immediately get the following error:

Value cannot be null.
Parameter name: value


I am using the trial version on Win 10 and with .NET Core 2.1. Oracle version is XE 11.2 (in my dev environment), though I have also tried on Enterprise Edition 12.1 with the same results.

I have searched the forums, and while there are similar posts, none of them resolved the issue for me.

Below I have provided the output from EF Core's "Update-Database" command, and screenshots to document the installation, which I believe is correct.

Can someone please point me in the right direction to resolve this issue? Thank you.

Code: Select all

Output from “Update-Database”:
PM> Update-Database -v
Using project 'Repository'.
Using startup project 'Server'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile D:\Code\Server\Server\bin\Debug\netcoreapp2.1\Server.deps.json --additionalprobingpath C:\Users\Mike\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig D:\Code\Server\Server\bin\Debug\netcoreapp2.1\Server.runtimeconfig.json C:\Users\Mike\.nuget\packages\microsoft.entityframeworkcore.tools\2.1.1\tools\netcoreapp2.0\any\ef.dll database update --verbose --no-color --prefix-output --assembly D:\Code\Server\Server\bin\Debug\netcoreapp2.1\Repository.dll --startup-assembly D:\Code\Server\Server\bin\Debug\netcoreapp2.1\Server.dll --project-dir D:\Code\Server\GmnRepository\ --language C# --working-dir D:\Code\Server --root-namespace GmnRepository
Using assembly 'Repository'.
Using startup assembly 'Server'.
Using application base 'D:\Code\Server\Server\bin\Debug\netcoreapp2.1'.
Using working directory 'D:\Code\Server\Server'.
Using root namespace 'Repository'.
Using project directory 'D:\Code\Server\Repository\'.
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider...
Finding IWebHost accessor...
Using environment 'Development'.
Using application service provider from IWebHost accessor on 'Program'.
Found DbContext 'DbContext'.
Finding DbContext classes in the project...
Using context 'DbContext'.
Finding design-time services for provider 'Devart.Data.Oracle.Entity.EFCore'...
Using design-time services from provider 'Devart.Data.Oracle.Entity.EFCore'.
Finding design-time services referenced by assembly 'Server'.
No referenced design-time services were found.
Finding IDesignTimeServices implementations in assembly 'Server'...
No design-time services were found.
Executed DbCommand (113ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT COUNT(*)
FROM SYS.ALL_TABLES
WHERE (OWNER = SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AND TABLE_NAME IN ('Announcement', 'Assessments', 'Partner', 'Plan', 'Office'))
Executed DbCommand (14ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
CREATE TABLE "__EFMigrationsHistory" (
"MigrationId" NVARCHAR2(150) NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
PRIMARY KEY ("MigrationId")
)
Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT COUNT(*)
FROM SYS.ALL_TABLES
WHERE (OWNER = SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AND TABLE_NAME IN ('Announcement', 'Assessments', 'Partner', 'Plan', 'Office'))
Applying migration '20180817150432_InitialCreate'.
Page 2 of 6
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at _ ._(Object _)
at _ ._(Object[,] _)
at _ ._ _(InsertDataOperation _)
at _ ._ _(MigrationOperation _)
at _ ._(IEnumerable`1 _)
at _ ._(IEnumerable`1 _, _ _)
at Devart.Data.Oracle.Entity.Migrations.OracleEntityMigrationSqlGenerator.Generate(IReadOnlyList`1 migrationOperations, IModel model)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c__DisplayClass13_2.<GetMigrationCommandLists>b__2()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)

Value cannot be null.
Parameter name: value

PM>
Latest version installed:
Image

Trial key is installed:
]Image

NuGet package is installed:
Image

I can connect to the database using SQL Developer:
Image

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Update-Database error: Value cannot be null. Parameter name: value

Post by Shalex » Thu 23 Aug 2018 17:05

We cannot reproduce the issue at the moment. We have just sent a test project to your email. Does it work in your environment?

mikep
Posts: 4
Joined: Wed 22 Aug 2018 11:11

Re: Update-Database error: Value cannot be null. Parameter name: value

Post by mikep » Sat 25 Aug 2018 11:28

I have narrowed this down to an issue with data seeding a nullable property. I have sent you a response to your email and and your updated project to reproduce this issue. Thank you.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Update-Database error: Value cannot be null. Parameter name: value

Post by Shalex » Mon 27 Aug 2018 18:24

Thank you for the test project. We have reproduced the issue and are investigating it. We will notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Update-Database error: Value cannot be null. Parameter name: value

Post by Shalex » Fri 31 Aug 2018 19:08

The bug with using non-initialized nullable properties in data seeding in Code-First Migrations in EF Core 2 is fixed: viewtopic.php?f=1&t=37637.

Post Reply