Skip to content

Conversation

@gewarren
Copy link
Contributor


/// <summary>
/// Represents all of the options for the command, inherited options that have been applied to any of the command's ancestors.
/// Gets all of the options for the command, including inherited options that have been applied to any of the command's ancestors.

Choose a reason for hiding this comment

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

IIRC, this does not include inherited options.

Choose a reason for hiding this comment

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

/// <exception cref="NotSupportedException">Thrown if this method is called by Option-owned ArgumentResult.</exception>
/// <exception cref="ArgumentOutOfRangeException"><c>numberOfTokens - Value</c> must be at least 1.</exception>
/// <exception cref="InvalidOperationException">This method is called more than once.</exception>
/// <exception cref="NotSupportedException">This method is called by Option-owned ArgumentResult.</exception>

Choose a reason for hiding this comment

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

In practice, this exception is thrown if an Option has a CustomParser delegate that receives an ArgumentResult as a parameter and calls the OnlyTake method of that ArgumentResult.

Comment on lines 30 to 33
/// <summary>
/// The token that was parsed to specify the directive.
/// Gets the token that was parsed to specify the directive.
/// </summary>
public Token Token { get; }

Choose a reason for hiding this comment

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

This is unclear in the case where the command line has multiple directive tokens with the same name: [name] [name:value1] [name:value2]. IIRC the library parses those and collects all of them to the same DirectiveResult instance, whose Values property then is { "name1", "name2" } (not sure whether the null value is just lost entirely). But which token do you get in the Token property then?

/// int lastElement = someArray[^1]; // lastElement = 5
/// </code>
/// </remarks>
internal readonly struct Index : IEquatable<Index>

Choose a reason for hiding this comment

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

Because Index and Range are internal types here, and .NET documents the corresponding types in the System namespace, I don't think it is necessary to spend much time on improving their API docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Do you mean the docs tools read the System.Index and System.Range documentation from here, rather than from the dotnet/runtime repository? That seems like a bug that should be fixed in the tools; imagine if the documentation is later edited in dotnet/runtime and the edits don't get published because they are overridden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's a bit complex, but because the System.CommandLine package uses its compiler-generated XML file as the source of truth for docs, we import the XML doc file when we run the CI updates. And that will always overwrite whatever is already in dotnet-api-docs. For the APIs coming from dotnet/runtime, that package does not use the compiler generated XML file as the source of truth. So updates for Index/Range should always occur in dotnet-api-docs, not dotnet/runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, there was an internal customer suggestion I logged to the ingestion pipeline for docs that XML comments should only be imported from XML files where the file name matches the assembly name. But it wasn't fixed. So this is the next best option.

Choose a reason for hiding this comment

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

Would an alternative be just deleting the xml docs from this file altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That might work, but there might be an analyzer that checks for existence of docs?

Choose a reason for hiding this comment

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

I'm not aware of any analyzers that would warn about missing documentation. The compiler warning CS1591 won't trigger because these classes are internal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants