Abp.Domain.Uow.AbpDbConcurrencyException UserAppService_Link_Tests
See original GitHub issueGitHub Issues
bug
- Abp package version. 3.7.2
- Base framework: .Net Core
- Exception message and stack trace if available. Message: Abp.Domain.Uow.AbpDbConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values. ---- Abp.Domain.Uow.AbpDbConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values. -------- Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values.
Result StackTrace:
at ABP.EntityFrameworkCore.DataCentralDbContext.<SaveChangesAsync>d__1220.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.<SaveChangesInDbContextAsync>d__20.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.<SaveChangesAsync>d__12.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.<CompleteUowAsync>d__14.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Domain.Uow.UnitOfWorkBase.<CompleteAsync>d__57.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Domain.Uow.UnitOfWorkInterceptor.<>c__DisplayClass6_0.<<PerformAsyncUow>b__2>d.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserStore
2.<UpdateAsync>d__36.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserManager1.<UpdateUserAsync>d__174.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Identity.UserManager
1.<SetLockoutEnabledAsync>d__138.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Users.AbpUserManager2.<CreateAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at ABP.Tests.Authorization.Users.UserAppService_Link_Tests.<CreateTestUsersForAccountLinkingAsync>d__12.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at ABP.Tests.Authorization.Users.UserAppService_Link_Tests.<Should_Link_User_To_Already_Linked_User>d__9.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
----- Inner Stack Trace -----
at Abp.EntityFrameworkCore.AbpDbContext.<SaveChangesAsync>d__49.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext3.<SaveChangesAsync>d__98.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at ABP.EntityFrameworkCore.DataCentralDbContext.<SaveChangesAsync>d__1220.MoveNext()
----- Inner Stack Trace -----
at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryTable1.ThrowUpdateConcurrencyException(IUpdateEntry entry, Dictionary
2 concurrencyConflicts)
at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryTable1.Update(IUpdateEntry entry) at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryStore.ExecuteTransaction(IReadOnlyList
1 entries, IDiagnosticsLogger1 updateLogger) at Microsoft.EntityFrameworkCore.InMemory.Storage.Internal.InMemoryDatabase.SaveChangesAsync(IReadOnlyList
1 entries, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__79.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__77.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.DbContext.<SaveChangesAsync>d__52.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.EntityFrameworkCore.AbpDbContext.<SaveChangesAsync>d__49.MoveNext()
Result Message:
Abp.Domain.Uow.AbpDbConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values.
---- Abp.Domain.Uow.AbpDbConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values.
-------- Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException : Conflicts were detected for instance of entity type ‘User’ on the concurrency token properties {‘ConcurrencyStamp’}. Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting values.
- Steps needed to reproduce the problem. - Upgrade from 3.5.x to 3.7.2 run UserAppService_Link_Tests unit tests
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
@dontboyle wrapping UserManager.CreateAsync by a unitOfWork fixes this problem. Could you try that ?
For UserAppService_Link_Tests, you need to modify CreateTestUsersForAccountLinkingAsync (which is in AspNet Zero) method like below ;
@alirizaadiyahsi Sorry have been pulled off for a bit on a side problem, Yes @ismcagdas solution did in fact resolve the issue!