-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Span<T>(Void*, Int32) length is number of T elements, not bytes #2272
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
Thanks for fixing this. The source is correct :) |
xml/System/Span`1.xml
Outdated
@@ -155,8 +155,8 @@ If `array` is `null`, this constructor returns a `null` `Span<T>`. | |||
</Parameters> | |||
<Docs> | |||
<param name="pointer">A pointer to the starting address of a specified number of bytes in memory.</param> |
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.
Can you fix this as well? It states bytes still.
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.
Will do.
xml/System/Span`1.xml
Outdated
<param name="length">The number of bytes to be included in the <see cref="T:System.Span`1" />.</param> | ||
<summary>Creates a new <see cref="T:System.Span`1" /> object from a specified number of bytes starting at a specified memory address.</summary> | ||
<param name="length">The number of <typeparamref name="T"/> elements to be included in the <see cref="T:System.Span`1" />.</param> | ||
<summary>Creates a new <see cref="T:System.Span`1" /> object from a specified number of <typeparamref name="T"/> elements starting at a specified memory address.</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.
The ReadOnlySpan xml needs to be fixed too:
ReadOnlySpan Ctors
dotnet-api-docs/xml/System/ReadOnlySpan`1.xml
Line 107 in 3417fad
<summary>Creates a new <see cref="T:System.ReadOnlySpan`1" /> from a specified number of bytes starting at a specified memory address.</summary> |
It seems to have the correct length description, but uses the term, "object" rather than "elements". I prefer elements, but not sure which is best. cc @mairaw, @rpetrusha
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.
Good catch -- will do.
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.
Given the context, elements is better than objects, @ahsonkhan.
<param name="length">The number of <paramref name="T" /> objects to be included.</param> | ||
<summary>Creates a new <see cref="T:System.ReadOnlySpan`1" /> from a specified number of bytes starting at a specified memory address.</summary> | ||
<param name="pointer">A pointer to the starting address of a specified number of <typeparamref name="T" /> elements in memory.</param> | ||
<param name="length">The number of <typeparamref name="T" /> elements to be included in the <see cref="T:System.ReadOnlySpan`1" />.</param> |
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 changed paramref
to typeparamref
. It's correct from C#-compiler's point of view, but is it also correct here for the docs?
closing and reopening for a new build. |
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.
Thanks, @gfoidl, for correcting the parameter description and changing the paramref
element to a typeparamref
element. We'll merge your PR once the internal build completes successfully.
Closing and reopening again in the hope build will succeed. |
The error is probably an internal issue. Following up. |
The engineering team has deployed a fix but we need to wait until our master branch build finishes successfully. I'll retrigger a new build when that happens. |
Build should work now. Let's see 🤞 |
The
length
argument is for the number ofT
-elements, as can be seen in the code.Fixes #2271, #2045