Add info about failure modes to ConcurrentQueue Try methods#11588
Open
Smaug123 wants to merge 1 commit intodotnet:mainfrom
Open
Add info about failure modes to ConcurrentQueue Try methods#11588Smaug123 wants to merge 1 commit intodotnet:mainfrom
Smaug123 wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-collections |
Smaug123
commented
Jul 19, 2025
| <summary>Attempts to add an object to the <see cref="T:System.Collections.Concurrent.IProducerConsumerCollection`1" />.</summary> | ||
| <returns> | ||
| <see langword="true" /> if the object was added successfully; otherwise, <see langword="false" />.</returns> | ||
| <see langword="true" /> if the object was added successfully; otherwise, <see langword="false" />. (This operation never returns <see langword="false" /> for <xref:System.Collections.Concurrent.ConcurrentQueue%601>.)</returns> |
Contributor
Author
There was a problem hiding this comment.
This is mentioned in the remarks section below, but that is not the first place I looked for the answer, suggesting that more docs are required.
22ab3e8 to
6b8088d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The docs are currently silent on the failure modes of most of the
System.Collections.Generic.ConcurrentQueue.Try*methods. This PR clarifies what I believe are the semantics: that theTryoperations can only fail for the trivial reason that the queue was empty at the time the operation was attempted.