I am using the following code in my Windows 8 app function to catch an error and display an Message Dialog
catch (Exception ex)
{
MessageDialog err = new MessageDialog("Error");
await err.ShowAsync();
}
But I get an error "cannot await in the body of a catch clause".
But when I remove the await
, it works but I get a warning on the code "Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the await operator to the result of the call".
I need to display a message in this catch clause, how do I fix this?