Async method lifetime + FAQ enrichment#53158
Draft
BillWagner wants to merge 1 commit intodotnet:mainfrom
Draft
Conversation
1. Create `keeping-async-methods-alive.md` — from "Keeping async methods alive." Covers GC lifetime issues with fire-and-forget async tasks, preventing premature collection. 1. Decompose remaining Async/Await FAQ content into **existing** docs: - Update `consuming-the-task-based-asynchronous-pattern.md` with FAQ content about awaitables, `ConfigureAwait`, `SynchronizationContext` interaction. - Update `task-based-asynchronous-pattern-tap.md` with FAQ content about `async` keyword behavior, return types, naming conventions. - Update `implementing-the-task-based-asynchronous-pattern.md` with FAQ content about `Task.Start`, `Task` disposal. 1. Add new article to TOC.
gfoidl
reviewed
Apr 16, 2026
|
|
||
| ### FAQ: Awaitables, ConfigureAwait, and SynchronizationContext | ||
|
|
||
| `await` works with awaitable types, not just <xref:System.Threading.Tasks.Task>. A type is awaitable if it provides a compatible `GetAwaiter` pattern. In most public APIs, return <xref:System.Threading.Tasks.Task>, <xref:System.Threading.Tasks.Task`1>, <xref:System.Threading.Tasks.ValueTask>, or <xref:System.Threading.Tasks.ValueTask`1>, and use custom awaitables only for specialized scenarios. |
Member
There was a problem hiding this comment.
if it provides a compatible
GetAwaiterpattern
Reading this as layman rises the question what it that pattern?
Should it get explained, linked to some article, etc.?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
keeping-async-methods-alive.md— from "Keeping async methods alive." Covers GC lifetime issues with fire-and-forget async tasks, preventing premature collection.consuming-the-task-based-asynchronous-pattern.mdwith FAQ content about awaitables,ConfigureAwait,SynchronizationContextinteraction.task-based-asynchronous-pattern-tap.mdwith FAQ content aboutasynckeyword behavior, return types, naming conventions.implementing-the-task-based-asynchronous-pattern.mdwith FAQ content aboutTask.Start,Taskdisposal.Internal previews