-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix Task.WhenAny documentation typo: change "result value is true" to "This is true" #11477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…o 'This is true' Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
…ew feedback Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Tagging subscribers to this area: @dotnet/area-system-threading-tasks |
xml/System.Threading.Tasks/Task.xml
Outdated
@@ -7092,7 +7092,7 @@ An exception was thrown during | |||
|
|||
## Remarks | |||
|
|||
The returned task will complete when any of the supplied tasks has completed. The returned task will always end in the `RanToCompletion` state with its `Result` set to the first task to complete. The result value is `true` even if the first task to complete ended in the `Canceled` or `Faulted` state. | |||
The returned task will complete when any of the supplied tasks has completed. The returned task will always end in the `RanToCompletion` state with its `Result` set to the first task to complete. This is true even if the first task to complete ended in the `Canceled` or `Faulted` state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned task will complete when any of the supplied tasks has completed. The returned task will always end in the `RanToCompletion` state with its `Result` set to the first task to complete. This is true even if the first task to complete ended in the `Canceled` or `Faulted` state. | |
The returned task completes when any of the supplied tasks has completed. The returned task always ends in the `RanToCompletion` state with its `Result` set to the first task to complete. This is true even if the first task to complete ended in the `Canceled` or `Faulted` state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the suggested grammatical improvements to use more direct verb tenses: "completes" and "always ends" instead of "will complete" and "will always end". Updated in both locations. Fixed in commit ced5916.
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Head branch was pushed to by a user without write access
This PR fixes a documentation typo in the
Task.WhenAny
method remarks that was causing confusion about the return value.Problem
The documentation incorrectly stated:
This wording is misleading because the result value is not literally
true
- it's the first task to complete. The sentence was trying to convey that the behavior described (setting Result to the first task) is true regardless of the task's completion state.Solution
Changed the wording to:
This clarifies that the statement refers to the behavior being true, not the result value being the boolean
true
.Changes Made
WhenAny(Task task1, Task task2)
methodWhenAny<TResult>(Task<TResult> task1, Task<TResult> task2)
method/xml/System.Threading.Tasks/Task.xml
The fix makes the documentation consistent with other
WhenAny
overloads that already use the correct wording.Fixes #11350.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.