Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- What is your product version?
- What is your product type (Angular or MVC)?
- What is product framework type (.net framework or .net core)?
- .Net Core
This GetUserByIdAsync will throw an exception if the userID is not found. The code after it checks for user!=null and user ==null which would never happen and thus the user gets an UnFriendlyException message.
I change my code to
var user = await UserManager.Users.FirstOrDefaultAsync(u => u.Id == input.UserId);
to get ensure we could get a null user.
PS: I'm not sure how my user actually got this error, but we had a case where someone was trying to activate with userid = 0 which threw this exception. We're still investigating that.