-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added documentation for new System.Net APIs released in 3.0 #2663
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
Conversation
|
@davidsh @wfurt @krwq @scalablecory since you are the System.Net owners, could you please take a look? |
xml/System.Net/CookieCollection.xml
Outdated
| <remarks>To be added.</remarks> | ||
| <param name="cookie">The <see cref="T:System.Net.Cookie" /> to remove form the <see cref="T:System.Net.CookieCollection" />.</param> | ||
| <summary>Determines whether the <paramref name="cookie" /> is in the <see cref="T:System.Net.CookieCollection" />.</summary> | ||
| <returns><see langword="true" /> if item was successfully removed from the <see cref="T:System.Net.CookieCollection" />; otherwise, <see langword="false" />. This method also returns <see langword="false" /> if item is not found in the original collection.</returns> |
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.
if item is not found in the original collection
Was this copied from ICollection? There is no "item" parameter here.
xml/System.Net/FileWebRequest.xml
Outdated
| <returns>To be added.</returns> | ||
| <remarks>To be added.</remarks> | ||
| <summary>Returns a <see cref="T:System.IO.Stream" /> object for writing data to the file system resource as an asynchronous operation.</summary> | ||
| <returns>The Task object representing the asynchronous operation.</returns> |
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.
"Task" -> <see cref="...Task"/>.
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.
@scalablecory @jozkee there is a neat feature to help provide code suggestions that can be bulk merged:
| <returns>The Task object representing the asynchronous operation.</returns> | |
| <returns>The <see cref="T:System.Threading.Tasks.Task" /> object representing the asynchronous operation.</returns> |
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.
Note: The comment is already outdated so you may ignore it.
xml/System.Net/IPEndPoint.xml
Outdated
| <summary>To be added.</summary> | ||
| <returns>To be added.</returns> | ||
| <param name="s">A <see cref="T:System.RedOnlySpan`1" /> that contains an IP endpoint in dotted-quad notation or network byte order for IPv4 and in colon-hexadecimal notation for IPv6.</param> | ||
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> |
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.
RedOnlySpan -> ReadOnlySpan
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.
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> | |
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.ReadOnlySpan`1" /> to an <see cref="T:System.Net.IPEndPoint" /> instance.</summary> |
| <param name="s">A <see cref="T:System.RedOnlySpan`1" /> that contains an IP endpoint in dotted-quad notation or network byte order for IPv4 and in colon-hexadecimal notation for IPv6.</param> | ||
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> | ||
| <returns>An <see cref="T:System.Net.IPEndPoint" /> instance.</returns> | ||
| <remarks>To be added.</remarks> |
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.
Remarks still todo?
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.
Since overloads are generated in the same html, for this case and TryParse I think it would be redundant to have practically the same remarks twice.
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.
Yes, that's good. But if they are applicable to both, the best would be to create a MemberGroup element and add the remarks there.
Here's an example I did this for:
6950528
https://docs.microsoft.com/en-us/dotnet/api/windows.foundation.point.tostring?view=dotnet-uwp-10.0
Otherwise, only one of the overloads have those remarks:
https://review.docs.microsoft.com/en-us/dotnet/api/system.net.ipendpoint.tryparse?view=netcore-3.0&branch=pr-en-us-2663#System_Net_IPEndPoint_TryParse_System_String_System_Net_IPEndPoint__
I can help you to format that in this PR if you'd like.
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.
Remarks are optional, @scalablecory
xml/System.Net/FileWebRequest.xml
Outdated
| <returns>To be added.</returns> | ||
| <remarks>To be added.</remarks> | ||
| <summary>Returns a response to a file system request as an asynchronous operation.</summary> | ||
| <returns>The Task object representing the asynchronous operation.</returns> |
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.
"Task" -> <see cref="...Task"/>.
xml/System.Net/FileWebRequest.xml
Outdated
| <format type="text/markdown"><![CDATA[ | ||
| ## Remarks | ||
| > [!NOTE] | ||
| > In the case of asynchronous requests, it is the responsibility of the client application to implement its own time-out mechanism. |
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.
Should this be a link to something describing how to implement time-outs?
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.
there is an example for HttpWebRequest.BeginGetResponse I could adapt it to FileWebRequest.GetResponseAsync in case is really needed.
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.
Created issue #2672 to address this later.
|
You can see when your changes on the staging site: https://review.docs.microsoft.com/en-us/dotnet/api/system.net.ipendpoint?view=netcore-3.0&branch=pr-en-us-2663 |
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.
Nice job documenting these @jozkee! Left a few comments for you.
xml/System.Net/IPEndPoint.xml
Outdated
| <summary>To be added.</summary> | ||
| <returns>To be added.</returns> | ||
| <param name="s">A <see cref="T:System.RedOnlySpan`1" /> that contains an IP endpoint in dotted-quad notation or network byte order for IPv4 and in colon-hexadecimal notation for IPv6.</param> | ||
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> |
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.
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> | |
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.ReadOnlySpan`1" /> to an <see cref="T:System.Net.IPEndPoint" /> instance.</summary> |
| <param name="s">A <see cref="T:System.RedOnlySpan`1" /> that contains an IP endpoint in dotted-quad notation or network byte order for IPv4 and in colon-hexadecimal notation for IPv6.</param> | ||
| <summary>Converts an IP network endpoint (address and port) represented as a <see cref="T:System.RedOnlySpan`1" /> to an IPEndPoint instance.</summary> | ||
| <returns>An <see cref="T:System.Net.IPEndPoint" /> instance.</returns> | ||
| <remarks>To be added.</remarks> |
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.
Yes, that's good. But if they are applicable to both, the best would be to create a MemberGroup element and add the remarks there.
Here's an example I did this for:
6950528
https://docs.microsoft.com/en-us/dotnet/api/windows.foundation.point.tostring?view=dotnet-uwp-10.0
Otherwise, only one of the overloads have those remarks:
https://review.docs.microsoft.com/en-us/dotnet/api/system.net.ipendpoint.tryparse?view=netcore-3.0&branch=pr-en-us-2663#System_Net_IPEndPoint_TryParse_System_String_System_Net_IPEndPoint__
I can help you to format that in this PR if you'd like.
xml/System.Net/IPEndPoint.xml
Outdated
| ## Remarks | ||
| The number of parts (each part is separated by a period) in the string s determines how the endpoint's IP address is constructed. A one part address is stored directly in the network address. A two part address, convenient for specifying a class A address, puts the leading part in the first byte and the trailing part in the right-most three bytes of the network address. A three part address, convenient for specifying a class B address, puts the first part in the first byte, the second part in the second byte, and the final part in the right-most two bytes of the network address. For Example: | ||
| |Number of parts and example `s`|IPv4 address for IPEndPoint.Address|Port |
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.
| |Number of parts and example `s`|IPv4 address for IPEndPoint.Address|Port | |
| |Number of parts and example `s`|IPv4 address for IPEndPoint.Address|Port| |
xml/System.Net/IPEndPoint.xml
Outdated
| |2 -- "20.65535:23"|20.0.255.255|23| | ||
| |3 -- "128.1.2:443"|128.1.0.2|443| | ||
| Note that this method accepts as valid an string value that can be parsed as an Int64, and then treats that Int64 as the long value of an IP address in network byte order, similar to the way that the IPAddress constructor does. This means that this method returns true if the Int64 is parsed successfully, even if it represents an address that's not a valid IP address. For example, if s is "1", this method returns true even though "1" (or 0.0.0.1) is not a valid IP address and you might expect this method to return false. Fixing this bug would break existing apps, so the current behavior will not be changed. Your code can avoid this behavior by ensuring that it only uses this method to parse IP addresses in dotted-decimal format. |
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.
This seems like an important note.
| Note that this method accepts as valid an string value that can be parsed as an Int64, and then treats that Int64 as the long value of an IP address in network byte order, similar to the way that the IPAddress constructor does. This means that this method returns true if the Int64 is parsed successfully, even if it represents an address that's not a valid IP address. For example, if s is "1", this method returns true even though "1" (or 0.0.0.1) is not a valid IP address and you might expect this method to return false. Fixing this bug would break existing apps, so the current behavior will not be changed. Your code can avoid this behavior by ensuring that it only uses this method to parse IP addresses in dotted-decimal format. | |
| > [!IMPORTANT] | |
| > Note that this method accepts as valid an string value that can be parsed as an <xref:System.Int64>, and then treats that <xref:System.Int64> as the long value of an IP address in network byte order, similar to the way that the <xref:System.Net.IPAddress> constructor does. This means that this method returns `true` when the <xref:System.Int64> is parsed successfully, even if it represents an address that's not a valid IP address. For example, if `s` is "1", this method returns `true` even though "1" (or 0.0.0.1) is not a valid IP address. Fixing this bug would break existing apps, so the current behavior will not be changed. Your code can avoid this behavior by ensuring that it only uses this method to parse IP addresses in dotted-decimal format. |
|
All of these types and methods aren't really new. What's new is that there are some overloads with ReadOnlySpan instead of other buffer types. So, I would advise looking at that existing documentation to re-use most of the same descriptions of parameters, remarks, return values, etc. We only need small changes when new parameter types such as the ReadOnlySpan are added. |
|
This is ready for re-review:
|
|
@mairaw, @rpetrusha, Its been a while since I've addressed the comments on this one, can we merge it? |
|
Taking a look now @jozkee! |
|
@jozkee I've made some changes to the three files. Can you make sure I didn't introduce anything wrong? Also let me know if you dislike any of the changes I made. Thanks! |
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.
I added a few comments regarding CookieCollection.GetEnumerator, other than that, your changes looks pretty good.
Also, nice catch on CookieCollection.Remove
|
@mairaw Looks good to me, can we merge? |
|
@mairaw thanks for your last commit to fix the broken cref. The latest build passed without warnings. Is this good to merge? |
|
@mairaw successful build with no warnings. I think it's ready to merge. |
List of APIs documented: