I tried to use mvvmlight as my mvvm model but there some error I don't understand. It said I cant void cant use await. If void cant use await then what should I do in here here is my code:
async void OnLoginButtonClicked(object sender)
{
try
{
var result = await App.AuthenticationClient.AcquireTokenAsync(
Constants.Scopes,
string.Empty,
UiOptions.SelectAccount,
string.Empty,
null,
Constants.Authority,
Constants.SignUpSignInPolicy);
await _navigationservice.NavigateTo(Locator.MainPageViewModel);
}
catch (MsalException ex)
{
if (ex.Message != null && ex.Message.Contains("AADB2C90118"))
{
await OnForgotPassword();
}
if (ex.ErrorCode != "authentication_canceled")
{
// await DisplayAlert("An error has occurred", "Exception message: " + ex.Message, "Dismiss");
}
}
}
and the error is in the await _navigationservice.NavigateTo(Locator.MainPageViewModel);
it shows error message right this Cannot await 'void'
what should I do here?