MVC ASP.NET Object reference not set to an instance of an object : I am trying to display information of the current logged in user. In **AccountController** I added the following ActionResult:

    public class AccountController : Controller
        {
            private ApplicationSignInManager _signInManager;
            private ApplicationUserManager _userManager;
            
            public AccountController()
            {
            }
    
            //.......
    
    public ActionResult Profile()
            {
                var userId = User.Identity.GetUserId();
                if(userId == null)
                {
                    return RedirectToAction("Login", "AccountControler");
                }
                else
                {
                    ApplicationUser user = _userManager.FindByIdAsync(userId).Result;
                   
                    return View(user);
                }
            }
However, I get the following Exception User-Unhandled: *Object reference not set to an instance of an object. _userManager was null*

