Whether you’re building mobile or web applications, it highly likely that you’ve come across the async / await keywords in the .NET code you’re working on. This combo makes working with asynchronous operations really easy, but can also lead into hard to debug issues if they aren’t used correctly.
In this episode, we are joined by Cloud Developer Advocate Brandon Minnick (@BrandonXamarin) who shows us what’s really going on under the covers with the async / await keywords, and he also gives shares some helpful tips.
- [00:57] – What’s the relationship between Xamarin and Azure
- [02:25] – HackerNews mobile app demo
- [04:06] – async / await under the covers
- [08:43] – Benefits for desktop or mobile applications
- [09:65] – Refactoring async operations with commands
- [12:52] – Don’t use .Wait()
- [15:41] – Avoiding context switches with ConfigureAwait(false)
- [19:45] – Sometimes you don’t need to use async / await
- [21:22] – Using async / await inside of try/catch and using statement blocks
- [23:40] – Summarizing best practices
- [25:37] – Use cases for ValueTask
Check out the links below to learn more.
Brandon Minnick – Async/Await Best Practices | On .NET
Source: MSDN Channel 9