stranger. Set return type Task instead of void.
// this throw an Exception
protected async void OnLogin()
{
navigationManager.NavigateTo("/");
}
// this this works in my case
protected async Task OnLogin()
{
navigationManager.NavigateTo("/");
}