Skip to content

Conversation

@adamsitnik
Copy link
Member

  • stop using System.CommandLine.NamingConventionBinder as it's reflection based and won't be supported in the long term

  • stop using ancient System.CommandLine.Experimental

Contributes to dotnet/sdk#33157

stop using System.CommandLine.NamingConventionBinder as it's reflection based and won't be supported in the long term
stop using ancient System.CommandLine.Experimental
@adamsitnik adamsitnik requested review from a team as code owners June 12, 2023 15:02
@ghost ghost added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead Community The pull request was submitted by a contributor who is not a Microsoft employee. labels Jun 12, 2023
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-libraries" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
Copy link
Member

Choose a reason for hiding this comment

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

Nine different dotnet feeds now ... I feel like we're making NuGet unnecessarily complicated.


var parser = CreateCommandLineParser();
return await parser.InvokeAsync(args);
return await parser.Parse(args).InvokeAsync(CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

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

What cancellation token should be going in here? Was the old behavior listening to Ctrl+C to raise the token or not?

Copy link
Member

Choose a reason for hiding this comment

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

The docs show InvokeAsync with no cancellationtoken. Might be one of our analyzers telling it to pass a cancellation token?
https://learn.microsoft.com/en-us/dotnet/standard/commandline/handle-termination

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Generally looks OK, some questions about cancellation tokens but that could be done as a follow-up.

var logLevelOption = new CliOption<LogLevel>("--logLevel")
{
var value = result.Tokens.Single().Value;
return !Enum.TryParse<LogLevel>(value, out var logLevel)
Copy link
Member

Choose a reason for hiding this comment

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

@dibarbet Were enums just not supported on the version we were on or was this necessary for some special reason?

Copy link
Member

Choose a reason for hiding this comment

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

I honestly don't remember. If this works with VSCode then I'm good with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

enums are now supported OOTB, I can not speak about the past as I've been involved in this project only for a year and a half

cancellationToken);
});

return generateCommand.Parse(args).InvokeAsync(CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

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

Same question as earlier: what should go here for the token?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same question as earlier: what should go here for the token?

If this is Main, then None.

If this was any other async method that would have it's own token, then that token.

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

Labels

Area-Infrastructure Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants