-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConfigureAwait(false) when yes / no #31
Comments
Looks like it's scenario yet to be written |
There's already some good info on this here. |
Also this section need "NOTE" about "result is actually semantically different to async/await", that in case of ConfigureAwait(false) they are actualy equal. |
will be great to have define this very soon xD I read about don't do ConfigureAwait(false) https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html and in other place I see it's very recommended but if finally it's necessary configure then the code in many place |
@jecaestevez I really recommend to read the cookbook from VS, as mentioned from WiredUK. The blog post you mentioned, in my opinion, refers to "don't block async code" and don't really explain a general solution for ConfigureAwait(). (Avoid using Task.Result and Task.Wait) |
Any news on this? |
I noticed omnisharp started recommending configure await for every async method now. Seems a little incorrect based on this discussion. Has anyone else noticed this? |
I really dislike the "put configureawait everywhere" drumbeat. If I have to do something everywhere I try to find a better solution. The need to put configureawait(false) everywhere stems from libraries wanting to not block the synchronization context of an arbitrary caller. The configureawait pattern only guarantees this it if you do it at every async call because you don't know if any of the previous calls will actually complete asynchronously. But you can also get the same result by just stripping the context at your public entry point and guaranteeing it is restored before finishing by using something like this https://github.com/negativeeddy/blog-examples/blob/master/ConfigureAwaitBehavior/ExtremeConfigAwaitLibrary/SynchronizationContextRemover.cs |
There is a very good article from @stephentoub available. He also mentions some proposals how this whole thing could be addressed:
There is also a proposal for more options with I think until there is any decision here, we can stick with the recommendations of Stephen:
|
Great repo David.
Any best practice about
ConfigureAwai(false)
? When is good to use it and when is not?ùThanks
The text was updated successfully, but these errors were encountered: