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

Add documentation to System.Net #57855

Merged
merged 27 commits into from
Sep 8, 2021
Merged

Conversation

FilipToth
Copy link
Contributor

@FilipToth FilipToth commented Aug 20, 2021

This PR adds missing documentation to the HeaderEncodingSelector, HttpContent, SocketsHttpHandler, NegotiateStream and WebHeaderCollection types.

TODO:

  • P:System.Net.WebHeaderCollection.Item(System.String)
  • T:System.Net.Http.HeaderEncodingSelector`1
  • M:System.Net.Http.HttpContent.CreateContentReadStream(System.Threading.CancellationToken)
  • P:System.Net.Http.SocketsHttpHandler.Properties
  • M:System.Net.Security.NegotiateStream.WriteAsync(System.ReadOnlyMemory{System.Byte},System.Threading.CancellationToken)
  • M:System.Net.Security.NegotiateStream.WriteAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)

Contributes to #43859

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Aug 20, 2021
@ghost
Copy link

ghost commented Aug 20, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR adds missing documentation to the HeaderEncodingSelector, HttpContent, HttpRequestMessage, HttpRequestOptions, and WebHeaderCollection types.

Items that still need to be addressed:

  • M:System.Net.Http.HttpRequestOptions.#ctor`
  • M:System.Net.Http.HttpRequestOptionsKey`1.#ctor(System.String)
  • T:System.Net.Http.HttpRequestOptionsKey`1
  • P:System.Net.Http.HttpRequestOptionsKey`1.Key
  • P:System.Net.Http.SocketsHttpHandler.Properties
  • M:System.Net.Security.NegotiateStream.WriteAsync(System.ReadOnlyMemory{System.Byte},System.Threading.CancellationToken)
  • M:System.Net.Security.NegotiateStream.WriteAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)

Fixes: #43859

Author: FilipToth
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@dnfadmin
Copy link

dnfadmin commented Aug 20, 2021

CLA assistant check
All CLA requirements met.

@geoffkizer
Copy link
Contributor

Adding @carlossanlop because he understands this stuff best.

Some of this stuff, at least, has documentation already; e.g. https://docs.microsoft.com/en-us/dotnet/api/system.net.http.socketshttphandler.cookiecontainer?view=net-5.0

It's not in the doc comments in the source, but it exists out there somewhere that produces content like the link above.

@carlossanlop Can you comment here? What is the right thing to be doing for stuff like this?

@FilipToth
Copy link
Contributor Author

Adding @carlossanlop because he understands this stuff best.

I still don't think this is ready to be merged. I'll make this into a regular PR when I feel like the documentation is descriptive enough and compliant with all documentation standards. But I'd love to hear everyone's opinion on this addition and maybe what to refine. As I already mentioned, this is not the final thing.

Some of this stuff, at least, has documentation already; e.g. https://docs.microsoft.com/en-us/dotnet/api/system.net.http.socketshttphandler.cookiecontainer?view=net-5.0
It's not in the doc comments in the source, but it exists out there somewhere that produces content like the link above.

Yes, that is something I'll have to look into as it's planned to extract API documentation from the source code (#44969).
I just added the documentation as said here #43859. For example, some methods were said (in the table in issue #43859) to have a summary and parameter descriptions but weren't in the XML comments, but I found the documentation on MS Docs. This is a little messy as we essentially have two places for documentation. Should I also copy the missing XML Documentation from MS Docs into XML comments, just to be more consistent?

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

@carlossanlop do we care about porting back an existing documentation to triple slash? If so, shouldn't we do that automatically?

Also, some properties/methods have more details in the docs, e.g. PooledConnectionIdleTimeout#Property Value. Should that be ported as well?

@karelz
Copy link
Member

karelz commented Aug 23, 2021

@ManickaP there was effort to port docs back into triple-slash comments. We didn't act on it for 6.0, I assume it will be brought up again soon.

@ManickaP
Copy link
Member

there was effort to port docs back into triple-slash comments. We didn't act on it for 6.0, I assume it will be brought up again soon.

I better oriented myself in the original issue. Porting back docs to triple slash is not the goal of #43859. Which is what I see in this PR.

@FilipToth Only really missing pieces of documentation should be added. The table in the original issue says precisely what's missing. Please let me know if you still want to tackle this? Otherwise, I'll put up a PR on my own.

@ManickaP
Copy link
Member

And BTW the first item should be skipped since that API was removed in #37949

@FilipToth
Copy link
Contributor Author

Only really missing pieces of documentation should be added.

Ok, I'll go back and check all added documentation to see if it already exists.

Please let me know if you still want to tackle this? Otherwise, I'll put up a PR on my own.

Yes, I definitely still want to do this.

And BTW the first item should be skipped since that API was removed in #37949

Ok, Thank you.

@FilipToth FilipToth marked this pull request as ready for review August 30, 2021 15:38
@FilipToth
Copy link
Contributor Author

Ok, marking this as ready for review as I think this should be OK.
Can someone add @carlossanlop as a reviewer, I don't have the privileges to do so.

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

There are still some things in the table that are missing, e.g.:M:System.Net.Security.NegotiateStream.WriteAsync(System.ReadOnlyMemory{System.Byte},System.Threading.CancellationToken) etc.

So they either need to get added in this PR. Or the work can be split and this PR made only contributing to the original issue. Up to you @FilipToth.

@@ -10,6 +10,7 @@ namespace System.Net.Http
/// </summary>
/// <param name="headerName">Name of the header to specify the <see cref="Encoding"/> for.</param>
/// <param name="context">The <typeparamref name="TContext"/> we are enoding/decoding the headers for.</param>
Copy link
Member

Choose a reason for hiding this comment

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

There's a typo one line above, could you please fix that as well:

Suggested change
/// <param name="context">The <typeparamref name="TContext"/> we are enoding/decoding the headers for.</param>
/// <param name="context">The <typeparamref name="TContext"/> we are encoding/decoding the headers for.</param>

@@ -115,6 +115,9 @@ public HttpMethod Method
[Obsolete("HttpRequestMessage.Properties has been deprecated. Use Options instead.")]
public IDictionary<string, object?> Properties => Options;

/// <summary>
/// Gets the options for the HTTP request.
Copy link
Member

Choose a reason for hiding this comment

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

I'd expect this to get a bit more specific description so that users actually know what it's good for a and how to use it.
But the whole Options related docs are WASM addition so it's up them how much details they want to put in, cc @lewing.

@FilipToth
Copy link
Contributor Author

@ManickaP Thank you so much for the feedback. I'll be back with the requested changes.
As for the options, I can make it a bit more descriptive and we'll see if the WASM team thinks it's appropriate. If they won't, I'll remove it.

@FilipToth
Copy link
Contributor Author

OK, I've made the changes as requested in the review. But I'm not sure about the HttpRequestMessage.Options property. This is the summary I came up with: Gets the special flags to use for the HTTP request. It's used to configure the HTTP request.. I am not sure if it's sufficient, but if not, I can change it.

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

Still missing summary for P:System.Net.Http.SocketsHttpHandler.Properties based on the orig issue table.

@@ -473,6 +473,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
return WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), new ReadOnlyMemory<byte>(buffer, offset, count));
}

/// <returns>A <see cref="ValueTask"/> of void.</returns>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// <returns>A <see cref="ValueTask"/> of void.</returns>
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous read operation.</returns>

Copy link
Contributor Author

@FilipToth FilipToth Sep 6, 2021

Choose a reason for hiding this comment

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

Thank you.

@@ -484,6 +485,7 @@ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationTo
return new ValueTask(WriteAsync(new AsyncReadWriteAdapter(InnerStream, cancellationToken), buffer));
}

/// <returns>A <see cref="Task"/> of void.</returns>
Copy link
Member

Choose a reason for hiding this comment

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

This is a private method, not an API.

@ManickaP ManickaP requested a review from lewing September 6, 2021 13:44
@ManickaP
Copy link
Member

ManickaP commented Sep 6, 2021

@lewing Hi, could someone review the Options part?

@karelz karelz added this to the 7.0.0 milestone Sep 7, 2021
@ManickaP
Copy link
Member

ManickaP commented Sep 7, 2021

Hi @FilipToth, I just learned we need to get this in more urgently then we originally thought. So if you don't mind, I'll take over this PR.
I'll remove all the Options related docs, since we really need deeper explanations and that needs to be done by the team that did the change. I'll ping them offline and let them fill it separately. And I'll merge this PR as a contribution to the original issues instead of a full fix.
I hope you don't mind. We still appreciate your contribution and involvement, so thank you!

@lewing
Copy link
Member

lewing commented Sep 7, 2021

@pranavkm can you help review the options related work?

@FilipToth
Copy link
Contributor Author

FilipToth commented Sep 7, 2021

Hi @FilipToth, I just learned we need to get this in more urgently then we originally thought. So if you don't mind, I'll take over this PR.

Of course. I'm sorry, I just learned about the September 14th deadline. Makes sense to give you full control over the PR as this needs to be done fast. Thank you very much for your involvement with this community PR.

@ManickaP ManickaP removed the request for review from lewing September 8, 2021 07:48
@ManickaP ManickaP merged commit baf6353 into dotnet:main Sep 8, 2021
ManickaP added a commit to ManickaP/dotnet-api-docs that referenced this pull request Sep 8, 2021
ManickaP added a commit to dotnet/dotnet-api-docs that referenced this pull request Sep 9, 2021
* Ported docs from dotnet/runtime#57855

* Update xml/System.Net.Http/HeaderEncodingSelector`1.xml

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
@FilipToth FilipToth deleted the System.Net-Docs branch September 10, 2021 06:01
@ghost ghost locked as resolved and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http 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.

6 participants