Skip to content

Whitelist System.Private.CoreLib/System.Threading.Tasks.TaskContinuationOptions#10522

Open
LeQuackers wants to merge 1 commit intoFacepunch:masterfrom
LeQuackers:master
Open

Whitelist System.Private.CoreLib/System.Threading.Tasks.TaskContinuationOptions#10522
LeQuackers wants to merge 1 commit intoFacepunch:masterfrom
LeQuackers:master

Conversation

@LeQuackers
Copy link
Copy Markdown

Summary

This is a quick PR to whitelist TaskCreationOptions.RunContinuationsAsynchronously.

In short, TaskCompletionSource continuations are executed synchronously unless the TaskCreationOptions.RunContinuationsAsynchronously option is specified, which sucks.

There was a dotnet TPL cookbook that mentioned it as a best practice, but I can't find it for the life of me, so here's a MSDN devblog instead (see "Conclusion" section at the bottom):
https://devblogs.microsoft.com/premier-developer/the-danger-of-taskcompletionsourcet-class/

Motivation & Context

The motivation and context were mentioned in the summary as well; allowing TaskCompletionSource to run asynchronously.

Fixes: #10520

Implementation Details

The other TaskCreationOptions flags seem reasonable, but TaskCreationOptions.HideScheduler might be problematic and I'd like another pair of eyes on it.

Screenshots / Videos (if applicable)

Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • Public APIs are documented (if applicable)
  • Unit tests added where applicable and all passing
  • I’m okay with this PR being rejected or requested to change 🙂

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.

Whitelist TaskCreationOptions.RunContinuationsAsynchronously

1 participant