Open Closed

DbMigrator issue with data seed contributor after upgrade to 7.0.1 #4428


User avatar
0
ccernat created
  • ABP Framework version: v7.0.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • at Microsoft.EntityFrameworkCore.Internal.EntityFinder1.<LoadAsync>d__11.MoveNext() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.<EnsureCollectionLoadedAsync>d__351.MoveNext() at Volo.Abp.Domain.Repositories.RepositoryExtensions.<EnsureCollectionLoadedAsync>d__03.MoveNext() at Volo.Abp.Identity.IdentityUserStore.<AddToRoleAsync>d__40.MoveNext() at Microsoft.AspNetCore.Identity.UserManager1.<AddToRoleAsync>d__105.MoveNext() at Castle.DynamicProxy.AsyncInterceptorBase.<ProceedAsynchronous>d__141.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.<ProceedAsync>d__7.MoveNext() at Volo.Abp.Uow.UnitOfWorkInterceptor.<InterceptAsync>d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31.MoveNext() at MHU.Data.MHUEmployeesDataSeedContributor.<CreateValidationOfficerAsync>d__9.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.Domain\Data\MHUEmployeesDataSeedContributor.cs:line 76 at MHU.Data.MHUEmployeesDataSeedContributor.<SeedAsync>d__8.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.Domain\Data\MHUEmployeesDataSeedContributor.cs:line 48 at Volo.Abp.Data.DataSeeder.<SeedAsync>d__7.MoveNext() at Castle.DynamicProxy.AsyncInterceptorBase.<ProceedAsynchronous>d__13.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.<ProceedAsync>d__7.MoveNext() at Volo.Abp.Uow.UnitOfWorkInterceptor.<InterceptAsync>d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__2.MoveNext() at MHU.Data.MHUDbMigrationService.<SeedDataAsync>d__11.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.Domain\Data\MHUDbMigrationService.cs:line 103 at MHU.Data.MHUDbMigrationService.<MigrateAsync>d__9.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.Domain\Data\MHUDbMigrationService.cs:line 53 at MHU.DbMigrator.DbMigratorHostedService.<StartAsync>d__3.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.DbMigrator\DbMigratorHostedService.cs:line 34 at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__12.MoveNext() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext() at MHU.DbMigrator.Program.<Main>d__0.MoveNext() in F:\EHV\MHUPortalWASM\MHU\src\MHU.DbMigrator\Program.cs:line 28
  • Steps to reproduce the issue: Upgrade to 7.0.1 and tried to run DBMigrator to seed some users."

Hello!

I upgraded to 7.0.1 and tried to add seed some users and add them to specific roles.

This is what running DbMigrator does:

Tks for providing any hint.


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can try creating a unit of work.

    https://docs.abp.io/en/abp/latest/Unit-Of-Work#unitofworkattribute https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

  • User Avatar
    0
    ccernat created

    hi

    it doesn't work. the thing is I literally did nothing than just upgrade packages to 7.01. it worked in all previous versions.

    same code.

    strange.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share a project to reproduce the problem. liming.ma@volosoft.com

  • User Avatar
    0
    ccernat created

    hello

    sent the solution's archive.

    tks alot.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please try to use a complex password.

    
    (await _identityUserManager.CreateAsync(user,
        "1q2w3E***@123"
    )).CheckErrors();
    
  • User Avatar
    0
    ccernat created

    God damn!

    It worked! It should have returned a more normal error message. Is this from the upgrade? Or?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You should always call CheckErrors method for IdentityResult.

    https://github.com/abpframework/abp/search?q=CheckErrors

  • User Avatar
    0
    ccernat created

    Thanks so much, maliming!

    You the best!

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38