Configure await fix + removed bunch of unnecessary async/await before return #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removed bunch of unnecessary async/await (*1) and added
.ConfigureAwait(false)to all remaining awaits because we don't want to be capturing context :).(1*): There's no point in awaiting a
Task<..>when it's result is immediately (without any alteration) returned because you can just as well return theTask<..>itself.While these two approaches produce different IL (awaiting and immediately returning the result results in a state machine being created and whole bunch of other stuff) the signature of the method (that either returns or awaits the return) remains the same either way which means this is a non-breaking change.
//StackOverflow backing me up: http://stackoverflow.com/questions/19098143/what-is-the-purpose-of-return-await-in-c
(It's highly likely that JIT actually optimizes the await before return away but why have it there if it's completely unnecessary).