Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
- ABP Framework version: v4.0.0
- UI type: Angular
- Tiered (MVC) or Identity Server Seperated (Angular): yes
- Exception message and stack trace:
* An exception occurred while iterating over the results of a query for context type 'Volo.Abp.IdentityServer.EntityFrameworkCore.IdentityServerDbContext'.
System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
   at Microsoft.Data.SqlClient.SqlBuffer.ThrowIfNull()
   at Microsoft.Data.SqlClient.SqlBuffer.get_Boolean()
   at Microsoft.Data.SqlClient.SqlDataReader.GetBoolean(Int32 i)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadBool(DbDataReader reader, Int32 ordinal, ReaderColumn column)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow()
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
   at Microsoft.Data.SqlClient.SqlBuffer.ThrowIfNull()
   at Microsoft.Data.SqlClient.SqlBuffer.get_Boolean()
   at Microsoft.Data.SqlClient.SqlDataReader.GetBoolean(Int32 i)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadBool(DbDataReader reader, Int32 ordinal, ReaderColumn column)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow()
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
D:\Projile\ABP-Suite\aspnet-core\src\Ezpand.DbMigrator\bin\Debug\net5.0\Ezpand.DbMigrator.exe (process 13132) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
- Steps to reproduce the issue:
Migrating current applicaiton from 3.3.1 to 4.0.0. Not able to run DBMigration service. Getting exception as above.
25 Answer(s)
- 
    0hi shobhit Identity Server 4 has a lot of breaking changes, have you applied to your project? https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-4_0#upgraded-to-identity-server-4-1-1 
- 
    0yes. i hope so. I have followed same document. 
- 
    0Hello maliming, Can you help me in the quick manner as i have upgraded my project and it is not running so i have all deliverable pending, Also ABP suite is also not working even if i do roll back. Please help. 
- 
    0hi You can create a new project of version 4.0. Then compare the code. If possible you can provide me with a project, I can download and check to it. liming.ma@volosoft.com How can I install a specific version of ABP Suite?https://support.abp.io/QA/Questions/287/How-can-I-install-a-specific-version-of-ABP-Suite 
- 
    0Hello maliming, Will creating new project only need code migration or even db migration. if both then i cannot do it. If it need only code then we can try. confirm. 
- 
    0I hope I can reproduce your problem. So I can check and solve it. Please provide the project or code. 
- 
    0can we do screen share. Before sharing code i will need all various approvals. 
- 
    0hi I can remotely check it by zoom tomorrow. (UTC +8) liming.ma@volosoft.com 
- 
    0hi You can consider deleting all migrations and then adding a new one. You can delete the Migrations folder. Please backup the database before trying. Re-adding the migration will solve your problem. This is a simple way, otherwise I need to get the source code of your project to check. 
- 
    0Please share the steps. will follow. consider i will create new database 
- 
    0Please back up the code and database. - delete the Migrations folder.
- run dotnet ef migrations add Initialcommand inxxx.EntityFrameworkCore.DbMigrationsfolder.
- run dotnet ef database updatecommand or runxxx.DbMigratorto apply.
 https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/ 
- 
    0As per instruction. 1- i have created new database 2- deleted migration folder 3- run "dotnet ef migrations add myproject" command 4- it generated migration folder again 5- run the "DBMigrator" 6- Error: Failed executing DbCommand (439ms) [Parameters=[@__providerName_0='?' (Size = 64)], CommandType='Text', CommandTimeout='30'] SELECT [a].[Id], [a].[Name], [a].[ProviderKey], [a].[ProviderName], [a].[Value] FROM [AbpSettings] AS [a] WHERE ([a].[ProviderName] = @__providerName_0) AND [a].[ProviderKey] IS NULL [14:42:25 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.SettingManagement.EntityFrameworkCore.SettingManagementDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpSettings'. 
- 
    0hi @shobhit Can you reproduce the problem in the 4.0 template project? Because I see you are using different connection strings for different modules. https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations 
- 
    0i have removed all connection string and having only Default now but still same issue. 
- 
    0hi shobhit Can you reproduce the problem in the 4.0 template project? You can try it. In that way I can quickly locate the problem. 
- 
    0i have created new 4.0 project and run the DBMigrator. It is running as expected. 
- 
    0hi I mean can you find some differences between your project and the template project that might be causing the problem. That is, if you copy some code of your project to the template project, the above problem occurs. 
- 
    0Oh then i have to copy lot of stuff. it is simply like creating new project. 
- 
    0If I cannot reproduce the problem, I cannot solve the problem. : ( 
- 
    0Ok. So as per suggestion i have created new ABP4.0 project. I run the DBMigrator and it has created the fresh db schema. Now when i am running DBMigrator again it is throwing error: [22:26:00 INF] Started database migrations... [22:26:00 INF] Migrating schema for host database... [22:26:05 ERR] Failed executing DbCommand (367ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE [AbpAuditLogs] ( [Id] uniqueidentifier NOT NULL, [ApplicationName] nvarchar(96) NULL, [UserId] uniqueidentifier NULL, [UserName] nvarchar(256) NULL, [TenantId] uniqueidentifier NULL, [TenantName] nvarchar(max) NULL, [ImpersonatorUserId] uniqueidentifier NULL, [ImpersonatorTenantId] uniqueidentifier NULL, [ExecutionTime] datetime2 NOT NULL, [ExecutionDuration] int NOT NULL, [ClientIpAddress] nvarchar(64) NULL, [ClientName] nvarchar(128) NULL, [ClientId] nvarchar(64) NULL, [CorrelationId] nvarchar(64) NULL, [BrowserInfo] nvarchar(512) NULL, [HttpMethod] nvarchar(16) NULL, [Url] nvarchar(256) NULL, [Exceptions] nvarchar(4000) NULL, [Comments] nvarchar(256) NULL, [HttpStatusCode] int NULL, [ExtraProperties] nvarchar(max) NULL, [ConcurrencyStamp] nvarchar(40) NULL, CONSTRAINT [PK_AbpAuditLogs] PRIMARY KEY ([Id]) ); 
- 
    0The reason for this situation may be that the __EFMigrationsHistorytable is empty after the first execution of DBMigrator.
- 
    0so what is the solution in this case. 
- 
    0hi Can you check the __EFMigrationsHistory table of the database after you exec the migration? Generally this does not happen. 
- 
    0cannot understood. what exactly i should check in __EFMigrationsHistory and what i should do to make sure the ABP suite runs??? 
- 
    0The problem cannot be reproduced. If you can reproduce the problem, please reopen it. 
 
                                