I have a Page_Loaded
event in an UWP application (Microsoft.NETCore.UniversalWindowsPlatform v6.2.10). I have made it async void
so I can call asynchronous methods:
private async void Page_Loaded(object sender, RoutedEventArgs e)
I tried to do this in above event
Task s1 = something.MyMethodAsync();
Task s2 = something.MyOtherMethodAsync();
await Task.WaitAll(s1, s2);
but am getting cannot await void error.
If I re-write it this way it's fine, but I lose some of the benefits of asynchronous calls
await something.MyMethodAsync();
await something.MyOtherMethodAsync();
Why is WaitAll
not working?