JudahGabriel / RavenDB.Identity

RavenDB Identity provider for ASP.NET Core. Let RavenDB manage your users and logins.
https://www.nuget.org/packages/RavenDB.Identity/1.0.0
MIT License
61 stars 29 forks source link

UserManager.AddToRolesAsync and UserManager.RemoveFromRolesAsync fails when roles are empty #32

Closed JoshClose closed 4 years ago

JoshClose commented 4 years ago

If I call UserManager.AddToRolesAsync or UserManager.RemoveFromRolesAsync with an IEnumerable with 0 results, an exception is thrown.

The given key 'users/test@test.com' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Raven.Identity.UserStore`2.UpdateAsync(TUser user, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Identity.UserManager`1.UpdateUserAsync(TUser user)
   at Microsoft.AspNetCore.Identity.UserManager`1.RemoveFromRolesAsync(TUser user, IEnumerable`1 roles)

If I find some time I'll find the issue and submit a pull request, but I've been pretty busy lately.

JudahGabriel commented 4 years ago

Thanks for the bug report.

Fixed, and pushed RavenDB.Identity v8.0.3 with the fix.

JoshClose commented 4 years ago

Thanks!