dotnet-api-docs icon indicating copy to clipboard operation
dotnet-api-docs copied to clipboard

Clarify ValueTask consumption guidance

Open YNan-varamor opened this issue 5 months ago • 2 comments

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 Task or a synchronous result may allow repeated awaits
  • arbitrary ValueTask instances should still be treated as single-consumption because they may be backed by pooled IValueTaskSource
  • AsTask remains 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.

YNan-varamor avatar Jun 16 '26 14:06 YNan-varamor

Tagging subscribers to this area: @dotnet/area-system-threading-tasks

dotnet-policy-service avatar Jun 16 '26 14:06 dotnet-policy-service

@dotnet-policy-service agree

YNan-varamor avatar Jun 17 '26 05:06 YNan-varamor

ping @tannergooding @jeffhandley for a technical review on the recommendations.

BillWagner avatar Aug 06 '26 15:08 BillWagner