Skip to content
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

Update docs for PipeReader.TryRead #52237

Merged
merged 5 commits into from
Oct 21, 2021

Conversation

waf
Copy link
Contributor

@waf waf commented May 4, 2021

As per #30161 (comment), add some documentation to PipeReader.TryRead to better describe some unclear behavior.

The unclear behavior technically resides in the StreamPipeReader implementation, which is internal, so I added this as a remark to the public PipeReader.TryRead method instead, so it will show up in the public documentation.

As per dotnet#30161 (comment), add some documentation to `PipeReader.TryRead` to better document some unclear behavior.

The unclear behavior technically resides in the `StreamPipeReader.TryRead` implementation, which is internal, so I added this as a `<remark>` to the public `PipeReader.TryRead` method instead.
@davidfowl
Copy link
Member

It's possible that TryRead should throw or block on StreamPipeReader instead of this documentation quirk. Feels a bit better than letting your application go into an infinite loop.

The StreamPipeReader <see .. /> reference is an internal type, so it should not be mentioned in the public documentation.
/// <remarks>
/// If the pipe returns <see langword="false" />, there is no need to call <see cref="System.IO.Pipelines.PipeReader.AdvanceTo(System.SequencePosition,System.SequencePosition)" />.
/// <para>
/// Note: the <see cref="System.IO.Pipelines.PipeReader" /> implementation returned by <see cref="System.IO.Pipelines.PipeReader.Create(System.IO.Stream, System.IO.Pipelines.StreamPipeReaderOptions?)"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dotnet/docs do we need to quote this and add a [!NOTE] for this to show up correctly?

I think so looking at this

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that you can use [!NOTE] because that's markdown. /// comments are HTML. I believe the only way to use markdown and the ms.docs syntax extensions (which [!NOTE] is) is to migrate this content to the external XML API files.

Tagging @BillWagner @gewarren for comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to wrap it in <format> tags like this:

/// <remarks><format type="text/markdown"><![CDATA[
.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment to use markdown and to use [!IMPORTANT] within the remarks. There were no uses of [!NOTE] anywhere else, but there were a couple other uses of [!IMPORTANT] within the Pipelines XML docs, so I followed that precedent.

@jeffhandley jeffhandley merged commit 60b51e4 into dotnet:main Oct 21, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO.Pipelines community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants