Skip to content

Task / ValueTask related guidance#230

Merged
dennisdoomen merged 1 commit into
dennisdoomen:masterfrom
czimpi:master
Jan 31, 2022
Merged

Task / ValueTask related guidance#230
dennisdoomen merged 1 commit into
dennisdoomen:masterfrom
czimpi:master

Conversation

@czimpi
Copy link
Copy Markdown
Contributor

@czimpi czimpi commented Jan 30, 2022

I found it somewhat misleading, that the deadlock example in 1835 is referencing ASP.NET, as this scenario was true for classical ASP.NET, but is not applicable for ASP.NET Core as explained by Stephen Cleary in this blog post. The title stating 'single-threaded environment' might also be somewhat confusing: Yes, this rule references special environments with their SynchronizationContext forcing a push-back of the continuation to a special dedicated context (rather than tacking a thread from the thread pool to continue with), but it still might be confusing, as it is possible to create multiple Tasks / Threads within e.g. WPF, so 'single-threaded' might not be the best wording.

I also created a new rule 1840, to explain the fallacies when using ValueTask / ValueTask<T> and advising to either directly await these special types or using .AsTask() to retrieve a Task / Task<T>.

@dennisdoomen
Copy link
Copy Markdown
Owner

Those are very good suggestions. Thanks for that.

@dennisdoomen dennisdoomen merged commit 4ad2ebe into dennisdoomen:master Jan 31, 2022
@bkoelman bkoelman mentioned this pull request Feb 1, 2022
@czimpi
Copy link
Copy Markdown
Contributor Author

czimpi commented Feb 1, 2022

The generic version of the ValueTask (ValueTask<T>) is not shown in the header (but within the description) on the website, but unfortunately I don't know how to mask it regarding the used build system.

@dennisdoomen
Copy link
Copy Markdown
Owner

The generic version of the ValueTask (ValueTask<T>) is not shown in the header (but within the description) on the website, but unfortunately I don't know how to mask it regarding the used build system.

Sorry, but I don't get your problem.

@czimpi
Copy link
Copy Markdown
Contributor Author

czimpi commented Feb 2, 2022

image

@bkoelman
Copy link
Copy Markdown
Contributor

bkoelman commented Feb 2, 2022

The generic version of the ValueTask (ValueTask) is not shown in the header (but within the description) on the website, but unfortunately I don't know how to mask it regarding the used build system.

Probably related to #209.

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.

3 participants