Skip to content

Conversation

@aholmes
Copy link

@aholmes aholmes commented Mar 12, 2020

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.

@vchirikov
Copy link
Contributor

asp.net core doesn't have SynchronizationContext

@aholmes
Copy link
Author

aholmes commented Mar 15, 2020

@vchirikov indeed! I addressed this on line 612 of the first commit (609 of the final PR).

@vchirikov
Copy link
Contributor

I mean it's very strange to mix up info about asp.net and asp.net core in repository with name AspNetCoreDiagnosticScenarios .

@aholmes
Copy link
Author

aholmes commented Mar 15, 2020

Fair point. I'll think about revising so it's more relevant.

@vchirikov
Copy link
Contributor

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.
Copy link
Owner

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using(var client = new HttpClient())
using (var client = new HttpClient())

var username = HttpContext.Current.Session["username"];

HttpResponseMessage result;
using(var client = new HttpClient())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using(var client = new HttpClient())
using (var client = new HttpClient())

public async Task<string> Get(int id)
{
HttpResponseMessage result;
using(var client = new HttpClient())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using(var client = new HttpClient())
using (var client = new HttpClient())

return $"{username}, your requested content is {content}";
}
```
# Scenarios
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Scenarios
# Scenarios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants