UserManager.AddToRolesAsync() and RemoveFromRolesAsync() fail on any conflict #55772
Open
1 task done
Labels
area-identity
Includes: Identity and providers
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
Milestone
Is there an existing issue for this?
Describe the bug
When adding multiple roles or generally updating a user's roles,
UserManager.AddToRolesAsync()
will fail upon finding that the user already has one of the given roles. Similary,UserManager.RemoveFromRolesAsync()
will fail if the user does not have any of the given roles to be removed.Expected Behavior
UserManager.AddToRolesAsync()
should add all given roles to the user and simply skip any that the user already has andUserManager.RemoveFromRolesAsync()
should remove all given roles from the user and simply skip any that the user does not have.Steps To Reproduce
Exceptions (if any)
No response
.NET Version
8.0.101
Anything else?
No response
The text was updated successfully, but these errors were encountered: