-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Backport docs for System.Numerics.Vectors #47725
Backport docs for System.Numerics.Vectors #47725
Conversation
Tagging subscribers to this area: @tannergooding, @pgovind Issue DetailsBackporting public API documentation from MS Docs into triple slash comments for the System.Numerics.Vectors namespace. This namespace was interesting for this experiment because all the source files live in The full description of the purpose of this PR is described in the issue #44969 - Pilot a new process that extracts API documentation from source code under the section "Bring documentation from Docs to triple slash". I ran the porting tool using this command:
|
Need to refresh this branch. There are some recent nullability changes causing a conflict. |
@@ -1,4 +1,8 @@ | |||
Microsoft Visual Studio Solution File, Format Version 12.00 |
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 guess these changes to the sln file are not intentional?
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.
Visual Studio made those changes automatically (first commit in the PR).
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 think these changes occur when a newer version of VS opens the sln. AFAIK, reverting these changes work, so that's what I've always done.
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.
It's kind of annoying having to revert the changes every time I have to submit a new commit. @safern would I break something if I keep the sln changes?
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'll keep this unless it causes any issues.
src/libraries/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj
Show resolved
Hide resolved
For implementation that lives in System.Private.CoreLib, we should run the tool with |
src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix3x2.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix3x2.cs
Outdated
Show resolved
Hide resolved
@@ -7,7 +7,8 @@ | |||
|
|||
namespace System.Numerics | |||
{ | |||
/// <summary>A structure encapsulating a 3x2 matrix.</summary> | |||
/// <summary>Represents a 3x2 matrix.</summary> | |||
/// <remarks>[!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]</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.
I'm not 100% sure if the INCLUDE syntax works in non-Markdown sections.
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.
@gewarren that's a good point. In the first PR, I was asked to remove the CDATA since it was not providing any value in triple slash comments, was using a lot of unnecessary space and polluting the code visually.
So I have a question for you to help address this: When we send intellisense xmls to the Docs build system, is it smart enough to automatically wrap non-empty remarks (including remarks that say To be added.
) with these tags?:
<format type="text/markdown><![CDATA[ ... ]]></format>
If not, then we have two options:
A) Convert markdown links like these to valid xml. Do you know what's the non-markdown syntax for a link to an md file? And do you know if the Docs build system will be able to read that correctly and render the md document properly?
B) Talk to the Docs dev team to request converting any remarks we send to them to markdown (if they don't do it yet).
Thoughts?
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.
Another thing to consider is that the xmls that Roslyn will produce after the source of truth are comments in source code, we will be shipping that as part of the intellisense xml files right? How will this look when a customer hovers over an API on VS and VS takes the info for that API from comments with these includes or [CDATA]
?
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.
AFAIK, remarks do not show up in VS intellisense in any way.
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.
Do you know what's the non-markdown syntax for a link to an md file?
I don't know. And the thing is, you don't just want a link, you actually want to import the contents of the linked file.
When we send intellisense xmls to the Docs build system, is it smart enough to automatically wrap non-empty remarks?
No, it does not. See for example here.
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.
@gewarren to address this problem, we can keep the CDATA section for remarks that require to show an include.
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.
That's what the machinelearning repo does for its linked code snippets. See https://github.com/dotnet/machinelearning/blob/master/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs#L30.
src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix3x2.cs
Outdated
Show resolved
Hide resolved
/// <returns>The product matrix.</returns> | ||
/// <remarks>The <see cref="System.Numerics.Matrix3x2.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Matrix3x2" /> objects.</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.
The crefs need to be prefixed with a P:
for property, M:
for method, etc. If this reference is referring to both overloads of the * operator, then I think the prefix is Overload:
.
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.
Doesn't C# add these automatically? If not should it be updated to do so?
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.
Oh yes, you are right. So this should be fine then. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/cref-attribute
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's even a code analysis rule that enforces not setting a prefix - https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1200.
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.
@gewarren There is a bug preventing me from indicating a method group in triple slash comments (the equivalent of Overload:
as you mentioned). There is an open issue tracking this problem in the csharplang repo: dotnet/csharplang#320
Would you mind helping me increase the priority/visibility of the csharplang issue? I am currently running the tool in other larger assemblies, and this is going to become a very common problem when porting types with lots of overloads (Process, FileStream are giving me a headache).
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.
Done!
@@ -8,28 +8,32 @@ | |||
namespace System.Numerics | |||
{ | |||
/// <summary>Represents a vector that is used to encode three-dimensional physical rotations.</summary> | |||
/// <remarks>The <see cref="System.Numerics.Quaternion" /> structure is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where: | |||
/// ``` |
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.
Not sure about using ``` in XML. Also, it should have a code language.
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. These are the cases that we need to manually move to a file in dotnet-api-docs, then link to it here.
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.
Found a bunch of these and I have converted them either to remarks with format + cdata, or to <c></c>
.
src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs
Outdated
Show resolved
Hide resolved
@gewarren @tannergooding @pgovind I marked this draft as ready for review. I addressed all your comments and suggestions and made sure the remarks with special markdown data show their information properly. Can you please take a look? |
{875DAA4F-1BC0-4EE2-9A04-EDD2FC5C773F} = {7A13467C-8469-4562-B00F-C4D61E8A1855} | ||
{BD5C16FE-CAAA-45CB-91F3-C66A2493C518} = {7A13467C-8469-4562-B00F-C4D61E8A1855} | ||
GlobalSection(SharedMSBuildProjectFiles) = preSolution | ||
..\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems*{634a3b2b-09f5-4810-b630-ade4d36c47df}*SharedItemsImports = 5 |
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 don't understand why this is being added? Did you change this on VS?
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.
No, I didn't modify the sln file myself. Visual Studio did this. I'll revert the sln file change.
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.
@safern reverted.
Learnings from this PR:
|
The two CI failures are unrelated to my change. I already tried re-running both legs 4 times and the failure is consistent. The
And the
|
Backporting public API documentation from MS Docs into triple slash comments for the System.Numerics.Vectors namespace.
This namespace was interesting for this experiment because all the source files live in
System.Private.CoreLib
, so the porting tool had to make sure to read theSystem.Numerics.Vectors.csproj
dependent projects and find the source code files in them.The full description of the purpose of this PR is described in the issue #44969 - Pilot a new process that extracts API documentation from source code under the section "Bring documentation from Docs to triple slash".
I ran the porting tool using this command:
Please compare the ported docs with their source files in dotnet-api-docs:
https://github.com/dotnet/dotnet-api-docs/tree/master/xml/System.Numerics