I don't know the difference beetween await a task and use task.Wait() but for the MessageDialog.ShowAsync method with the first it works but not with the second (while the two syntax works with other async methods).
If anyone could explain why i will be interested !
// this don't work, no dialog is shown (and UI is block)
var dialog = new MessageDialog("fail");
var task = dialog.ShowAsync().AsTask();
task.Wait();
// this work
var dialog = new MessageDialog("success");
var task = dialog.ShowAsync().AsTask();
await task;
You will ask me why i want to do this, it's because i need to show a dialog in a catch block (to show an error message) and wait for the user to close the dialog before continue after the catch block (and yes we can't use await in a catch block but we can use Task.Wait(), i've used it successfully with other async methods).