AccountController.cs houses the AccountController class. The Login method of that class is failing. Specifically,
var result = await SignInManager.PasswordSignInAsync(
model.Email, model.Password, model.RememberMe, shouldLockout: true);
within the Login method is throwing System.NullReferenceException.
I've verified that model.Email, model.Password, and model.RememberMe are not null. The next step is to dig in to SignInManager, which is an object on AccountController of type ApplicationSignInManager. The get accessor for SignInManager, which is called from the line above, was
public ApplicationSignInManager SignInManager
{
get
{
return _signInManager ??
HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
}
// private set...
}
which I rewrote as
public ApplicationSignInManager SignInManager
{
get
{
var c = HttpContext.GetOwinContext();
var m = c.Get<ApplicationSignInManager>();
return _signInManager ?? m;
}
// private set...
}
to debug and make sure that the get accessor was not returning null. It's not returning null. This tells me that something required inside PasswordSignInAsync is null.
I've looked at the source of PasswordSignInAsync and it does a pretty good job of guarding against null reference errors. I've also dug deeper into the methods called by PasswordSignInAsync. I simply don't see what could be throwing a null reference error.