Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

EntityNotFoundException when wrong password entered #2209


User avatar
0
terry bentley created

If I enter an incorrect password for a valid username I get an error "There is no entity User with id: nn!" where nn is the user id with the username entered. If I enter an invalid username I get the expected invalid login error.

I have only noticed this since upgrading to Abp 1.2

Here is the stack trace: ERROR 2017-01-03 10:44:00,856 [5 ] Cipher.Web.Controllers.AccountController - There is no such an entity. Entity type: RtTech.Cipher.Authorization.Users.User, id: 36 Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: RtTech.Cipher.Authorization.Users.User, id: 36 at Abp.Domain.Repositories.AbpRepositoryBase2.<GetAsync>d__17.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Repositories\AbpRepositoryBase.cs:line 86 --- 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() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120 --- 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.AbpUserStore2.<GetUserNameFromDatabaseAsync>d__64.MoveNext() in D:\Halil\Github\module-zero\src\Abp.Zero\Authorization\Users\AbpUserStore.cs:line 0 --- 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.<UpdateAsync>d__41.MoveNext() in D:\Halil\Github\module-zero\src\Abp.Zero\Authorization\Users\AbpUserManager.cs:line 343 --- 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.AspNet.Identity.TaskExtensions.CultureAwaiter1.GetResult() at Microsoft.AspNet.Identity.UserManager2.<AccessFailedAsync>d__157.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.AbpLogInManager3.<TryLockOutAsync>d__38.MoveNext() in D:\Halil\Github\module-zero\src\Abp.Zero\Authorization\AbpLoginManager.cs:line 259 --- 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.ValidateEnd(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsyncInternal>d__35.MoveNext() in D:\Halil\Github\module-zero\src\Abp.Zero\Authorization\AbpLoginManager.cs:line 182 --- 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.AbpLogInManager3.<LoginAsync>d__34.MoveNext() in D:\Halil\Github\module-zero\src\Abp.Zero\Authorization\AbpLoginManager.cs:line 0 --- 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() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120 --- 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.TaskAwaiter1.GetResult() at RtTech.Cipher.Web.Controllers.AccountController.<GetLoginResultAsync>d__22.MoveNext() in C:\Users\bentleyt\Source\Repos\cipher\src\RtTech.Cipher.Web\Controllers\AccountController.cs:line 210 --- 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.TaskAwaiter1.GetResult() at RtTech.Cipher.Web.Controllers.AccountController.<Login>d__19.MoveNext() in C:\Users\bentleyt\Source\Repos\cipher\src\RtTech.Cipher.Web\Controllers\AccountController.cs:line 136 --- 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() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120 --- 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.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.


7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Terry,

    Do you still have this problem ? I couldn't repeat it with the latest ABP.

  • User Avatar
    0
    terry bentley created

    Thanks! I upgraded to Abp 1.2.1 and the issue disappeared

  • User Avatar
    0
    terry bentley created

    The issue has not completely disappeared. I am getting the same error when I add a new tenant "There is no entity User with Id = 112?"

    It is happening on the "AddToRoleAsync" call. I have put the call in a separate unit of work just to make sure the database had finished adding the user and role. If I look in the database before the AddToRoleAsync call, the record is in the database, but the error message seems to indicate otherwise. //Used a third UOW to make sure the uers and roles are added before adding the relationship using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { using (_unitOfWorkManager.Current.SetTenantId(newTenantId)) { //Assign appaccount user to appaccount role! CheckErrors(await _userManager.AddToRoleAsync(appAccountUser.Id, appAccountRole.Name)); //Assign appaccount user to appaccount role! CheckErrors(await _userManager.AddToRoleAsync(calcAccountUser.Id, calcAccountRole.Name)); } await uow.CompleteAsync(); }

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you create an issue for this here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues">https://github.com/aspnetzero/aspnet-zero/issues</a> ? We will take a look at it soon.

    Thanks.

  • User Avatar
    0
    terry bentley created

    I added it as an issue although I noticed I was using our company KeithFlynn account

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks,

    We will check it soon.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Terry Bentley,

    I have checked with ABP v1.4. and it seems like this is working. Can you also check that ?

    Thanks.