-
Notifications
You must be signed in to change notification settings - Fork 770
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
Add notes for ConfigureAwait. #61
base: master
Are you sure you want to change the base?
Conversation
asp.net core doesn't have |
@vchirikov indeed! I addressed this on line 612 of the first commit (609 of the final PR). |
I mean it's very strange to mix up info about asp.net and asp.net core in repository with name |
Fair point. I'll think about revising so it's more relevant. |
Also you can include useful info from Stephen Toub |
|
||
:bulb:**NOTE Some advice states to use `ContinueAwait(false)` to avoid deadlocks. This is mistaken advice and does [not guarantee against deadlocks](https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html).** | ||
|
||
❌ **BAD** This example uses a global object and throws a `NullReferenceException` during runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove the ASP.NET examples (non core) as there's nothing else in this article that tries to explain that.
public async Task<string> Get(int id) | ||
{ | ||
HttpResponseMessage result; | ||
using(var client = new HttpClient()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using(var client = new HttpClient()) | |
using (var client = new HttpClient()) |
var username = HttpContext.Current.Session["username"]; | ||
|
||
HttpResponseMessage result; | ||
using(var client = new HttpClient()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using(var client = new HttpClient()) | |
using (var client = new HttpClient()) |
public async Task<string> Get(int id) | ||
{ | ||
HttpResponseMessage result; | ||
using(var client = new HttpClient()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using(var client = new HttpClient()) | |
using (var client = new HttpClient()) |
|
||
return $"{username}, your requested content is {content}"; | ||
} | ||
``` | ||
# Scenarios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Scenarios | |
# Scenarios |
Filled out the TBD under
ConfigureAwait
. Tried to stick to the formatting, verbiage, and style of the rest of the article. Added examples from ASP.NET Framework.