I have a WPF application (C# 6.0, .NET 6.1, Visual Studio 2015, x64) that freezes the interface when I start the following task:
private async void ComputeButton_Click(object sender, RoutedEventArgs e) {
await Scanner();
DrawButtons();
}
private static async Task Scanner() {
try {
BigBox.DoScan();
await Task.CompletedTask;
} catch (Exception ex) {
SMErrorLog.WriteLog("Scanner error: ", ex);
}
}
My application consists of several tabs. The above code is in one of the tabs. If I click on the "Compute" button, the computation proceeds (for several minutes), but I cannot select any of the other tabs to do something else while the computation proceeds. I assume the code above is asynchronous and I don't understand why the application freezes while the DoScan runs.
Any help or suggestions will be greatly appreciated.
Charles