ValueTask<TResult> documentation is outdated for .NET 10 - repeated await no longer throws
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
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:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/dotnet-api-docs
-
untriaged
Difficulty 1/5 Under an hour Newbie friendliness 88/100
dotnet/dotnet-api-docs#13039 · 1 comment ·
-
DisplayAttribute string properties: Remarks incorrectly state the property performs resource lookup Openarea-System.ComponentModel.DataAnnotations untriaged
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
dotnet/dotnet-api-docs#13023 · 1 comment ·
-
area-System.Net.Sockets untriaged
Difficulty 1/5 Under an hour Newbie friendliness 88/100
dotnet/dotnet-api-docs#13022 · 1 comment ·
-
area-System.Runtime untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/dotnet-api-docs#13015 · 1 comment ·
-
area-System.Runtime.InteropServices untriaged
Difficulty 1/5 Under an hour Newbie friendliness 84/100
dotnet/dotnet-api-docs#12959 ·
All issues in dotnet/dotnet-api-docs
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·