If I use
Application.Current.Dispatcher.BeginInvoke(new Action(() => { /*UI code here*/ }));
in a WPF project, Visual Studio 2019 gives me warning VSTHRD001:
Await JoinableTaskFactory.SwitchToMainThreadAsync() to switch to the UI thread instead of APIs that can deadlock or require specifying a priority.
How do I implement this suggestion?