Keeping the GUI responsive

Passing data from worker threads to the UI thread is always a chore no matter which programming language is used. Code can be a bear to develop, complex to read, and difficult to maintain. Race conditions, debugging, security access, etc – it’s all a not-so-fun part of coding.

I see that C# 4.0 introduced the async/await keywords. Evidently, these keywords are used to remove a lot of the special sauce normally involved in cross-thread programming. As I develop more in UWP, I also see that several functions I used to know and love from traditional WPF have been recreated with async/await.

Watch out!

I tried saving data upon suspending an app. The Microsoft routines that write files are all asynchronous. If the call to write the files is not awaited, the app will suspend before the file-write operation completes. See more at this SO question.