Description
The issue is related to Individual Accounts Authentication template. It seems that providing incorrect authentication code for ConfirmEmail action in AccountController (e.g. token which already expired) should result in displaying error page. However, Razor throws an exception while generating the default error view:
NullReferenceException: Object reference not set to an instance of an object.
AspNetCore._Views_Shared_Error_cshtml+<ExecuteAsync>d__0.MoveNext() in Error.cshtml, line 9
Steps to reproduce
Create new project with Individual Accounts Authentication template.
Further technical details
It's probably caused by the last line in ConfirmEmail action in AccountController:
var result = await _userManager.ConfirmEmailAsync(user, code);
return View(result.Succeeded ? "ConfirmEmail" : "Error");
When invalid token is passed, Error view is not provided with ErrorViewModel. When Model is accessed in 9th line of Error.cshtml (@if (Model.ShowRequestId)), it throws NullReferenceException.
Description The issue is related to Individual Accounts Authentication template. It seems that providing incorrect authentication code for ConfirmEmail action in AccountController (e.g. token which already expired) should result in displaying error page. However, Razor throws an exception while generating the default error view:
Steps to reproduce
Further technical details It's probably caused by the last line in ConfirmEmail action in AccountController:
When invalid token is passed, Error view is not provided with
ErrorViewModel
. WhenModel
is accessed in 9th line of Error.cshtml (@if (Model.ShowRequestId)
), it throws NullReferenceException.