Skip to content

Sync/Async wrapper article#52879

Open
BillWagner wants to merge 5 commits intodotnet:mainfrom
BillWagner:async-aweigh-1
Open

Sync/Async wrapper article#52879
BillWagner wants to merge 5 commits intodotnet:mainfrom
BillWagner:async-aweigh-1

Conversation

@BillWagner
Copy link
Copy Markdown
Member

@BillWagner BillWagner commented Apr 6, 2026

Contributes to dotnet#17714

Port the first two articles for wrapping async methods in synchronous methods, and wrapping synchronous methods in asynchronous methods.
Do a full review and edit.
@BillWagner BillWagner marked this pull request as ready for review April 7, 2026 16:01
@BillWagner BillWagner requested a review from a team as a code owner April 7, 2026 16:01
Copilot AI review requested due to automatic review settings April 7, 2026 16:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds two new conceptual docs under Asynchronous programming patterns that explain why library authors should generally avoid sync-over-async and async-over-sync wrappers, plus accompanying C# and Visual Basic snippets, and wires the new articles into the Advanced .NET programming TOC.

Changes:

  • Add new articles: Asynchronous wrappers for synchronous methods and Synchronous wrappers for asynchronous methods.
  • Add runnable C# and VB snippet projects referenced by the new articles.
  • Add both articles to docs/navigate/advanced-programming/toc.yml under TAP.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/standard/asynchronous-programming-patterns/synchronous-wrappers-for-asynchronous-methods.md New conceptual article describing sync-over-async risks and mitigations.
docs/standard/asynchronous-programming-patterns/async-wrappers-for-synchronous-methods.md New conceptual article describing why async-over-sync wrappers (Task.Run) are usually inappropriate for libraries.
docs/navigate/advanced-programming/toc.yml Adds the two new articles to the Advanced .NET programming navigation tree.
docs/standard/asynchronous-programming-patterns/snippets/synchronous-wrappers-for-async-methods/csharp/SyncWrappersForAsync.csproj New C# snippet project for the sync-over-async article.
docs/standard/asynchronous-programming-patterns/snippets/synchronous-wrappers-for-async-methods/csharp/Program.cs C# snippets demonstrating sync-over-async patterns, deadlock risk, and mitigations.
docs/standard/asynchronous-programming-patterns/snippets/synchronous-wrappers-for-async-methods/vb/SyncWrappersForAsync.vbproj New VB snippet project for the sync-over-async article.
docs/standard/asynchronous-programming-patterns/snippets/synchronous-wrappers-for-async-methods/vb/Program.vb VB snippets demonstrating sync-over-async patterns and mitigations.
docs/standard/asynchronous-programming-patterns/snippets/async-wrappers-for-synchronous-methods/csharp/AsyncWrappersForSync.csproj New C# snippet project for the async-over-sync article.
docs/standard/asynchronous-programming-patterns/snippets/async-wrappers-for-synchronous-methods/csharp/Program.cs C# snippets demonstrating Task.Run offloading vs scalability.
docs/standard/asynchronous-programming-patterns/snippets/async-wrappers-for-synchronous-methods/vb/AsyncWrappersForSync.vbproj New VB snippet project for the async-over-sync article.
docs/standard/asynchronous-programming-patterns/snippets/async-wrappers-for-synchronous-methods/vb/Program.vb VB snippets demonstrating Task.Run offloading vs scalability.

BillWagner and others added 3 commits April 7, 2026 12:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BillWagner BillWagner requested a review from adegeo April 7, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants