I am stuck with an issue where i am unable to create a New User using as.net core identity and i am using core 3.1. When ever i try to execute the code i get this error :
"An unhandled exception has occurred while executing the request. System.IndexOutOfRangeException: Index was outside the bounds of the array."
I am not able to understand. please find my code :
private readonly UserManager<ApplicationUser> _userManager;
private readonly RoleManager<IdentityRole> _roleManager;
private readonly IApplicationDbContext _context;
public IdentityService(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole>
roleManager, IApplicationDbContext context)
{
_userManager = userManager;
_roleManager = roleManager;
_context = context;
}
var user = new ApplicationUser
{
FirstName = firstName,
LastName = lastName,
UserName = userName,
Email = emailId
};
try
{
var result = await _userManager.CreateAsync(user, password); // here my code breaks
}
catch (Exception ex)
{
throw ex;
}
Aucun commentaire:
Enregistrer un commentaire