2017/03/15

Async Tip: why you should avoid void The guideline to prefer async method which return Task over async method that return void is quite known, but why should you follow the guideline? Code Snippet public async void NotRecomendedAsync() { // do something await SomeCodeWhichMayThrowAsync(); // do something } public async Task RecomendedAsync() { // do something await SomeCodeWhichMayThrowAsync(); // do something } The first obvious reason to use the guideline is testability. When you return void the test don’t really know when it is right time to check...