dotnet-api-docs
dotnet-api-docs copied to clipboard
Clarify ValueTask consumption guidance
Fixes #12704.
This updates the ValueTask and ValueTask<TResult> remarks so the guidance is less absolute and reflects the backing-source distinction:
- instances backed by
Taskor a synchronous result may allow repeated awaits - arbitrary
ValueTaskinstances should still be treated as single-consumption because they may be backed by pooledIValueTaskSource AsTaskremains the documented path when multiple consumption is needed
Validation:
git diff --check- confirmed the previous may-only-be-awaited-once wording no longer appears in the ValueTask XML docs
Disclosure: I used OpenAI Codex to implement and verify this documentation update.
Tagging subscribers to this area: @dotnet/area-system-threading-tasks
@dotnet-policy-service agree
ping @tannergooding @jeffhandley for a technical review on the recommendations.