ValueTask<TResult> documentation is outdated for .NET 10 - repeated await no longer throws

Open Beginner friendly
#12,704 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
csharp
Domain
documentation

Research direction

Open xml/System.Threading.Tasks/ValueTask.xml and locate the ValueTask remarks quoted in the issue. Compare the current wording with the reported .NET 10 behavior and update the documentation to accurately describe repeated awaits, Result access, AsTask(), and Preserve(); verify the rendered API page afterward.

Written by the indexing model from the issue text.

Description

area-System.Threading.Tasks untriaged
Type of issue

Typo

Description

The documentation for ValueTask on learn.microsoft.com states:

"A ValueTask instance may only be awaited once, and consumers may not read Result until the instance has completed."

In .NET 10.0.300 (release), this is no longer true. I tested the following scenarios and none of them threw an exception:

Awaiting the same ValueTask instance multiple times

Calling .AsTask() multiple times

Accessing .Result before the task completed

Calling .Preserve() after .AsTask()

The documentation should be updated to reflect the actual behavior in .NET 10

Example:

Image

Expected behavior (per docs): The second await should throw InvalidOperationException.

Actual behavior (.NET 10.0.300): Both await calls succeed and print the same result.

Environment:

.NET 10.0.300

Windows x64

Console application targeting net10.0

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask?view=net-10.0

Content source URL

https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.Threading.Tasks/ValueTask.xml

Document Version Independent Id

8146b64b-4225-5572-23b2-c959597dfb55

Platform Id

5c4fec22-5232-0ebf-2ed8-a486d802cf53

Article author

@dotnet-bot

Dominant language
C#
Stars
950
Forks
1.7k
Avg merge
3d 5h
Merged PRs (30d)
38

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/dotnet-api-docs

All issues in dotnet/dotnet-api-docs

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.