"Value cannot be null. (Parameter 'value') when using claims to login

Hi my login controller is bellow:

   [HttpPost]
    [Route("Login")]
    public IActionResult Login(LoginViewModel login)
    {
        if (!ModelState.IsValid)
        {
            return View("Login");
        }
        var user = _userService.LoginUser(login);
        if (user != null)
        {
            if (user.IsActive)
            {
                var claims = new List<Claim>()
                {
                   new 
   Claim(ClaimTypes.NameIdentifier,user.UserId.ToString()),
                   new Claim(ClaimTypes.Name,user.UserName),
                   new 
   
Claim(ClaimTypes.Role,user.UserRoles?.FirstOrDefault().Role.RoleTitle)
                };
                var identity = new ClaimsIdentity(claims, 
       CookieAuthenticationDefaults.AuthenticationScheme);
                var principal = new ClaimsPrincipal(identity);
                var properties = new AuthenticationProperties
                {
                    IsPersistent = login.RememberMe
                };

                HttpContext.SignInAsync(principal, properties);

                ViewBag.IsSuccess = true;
                return View();
            }
            else
            {
                ModelState.AddModelError("Email", "not active");
            }
        }

        ModelState.AddModelError("Email", "not found ");
        return View(login);
    }    

when I want to login as it reach the line "var claims = new List() ..." it throws error "Value cannot be null. (Parameter 'value')" and the whole error is :

System.Security.Claims.Claim..ctor(String type, String value, String valueType, String issuer, String originalIssuer, ClaimsIdentity subject, String propertyKey, String propertyValue)\r\n at System.Security.Claims.Claim..ctor(String type, String value)\r\n
at Fraud.Controllers.AccountController.Login(LoginViewModel login) in D:\Project\Fraud\Fraud\Controllers\AccountController.cs:line 128\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<g__Logged|12_1>d.MoveNext()"

I'd be thankful, anyone help me!

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum