-
Notifications
You must be signed in to change notification settings - Fork 1.2k
remove dependency to System.CommandLine.Rendering #46209
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
remove dependency to System.CommandLine.Rendering #46209
Conversation
…nsions.Logging.Console instead
| string? verbosity, | ||
| string? binarylog, | ||
| string? report, | ||
| IConsole console); |
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 delegate was using IConsole abstraction from System.CommandLine.Rendering. Initially I just wanted to update it, but then I got to the conclusion that it's not being used anywhere and can be deleted. But I can be wrong as not all VS features work for me when I work with a local build of the SDK.
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.
Seems like we missed removing this in a refactor at some point. Thanks!
|
I've added the NO MERGE label to ensure that it's not merged before the Preview 1 snap. |
|
@adamsitnik I tried out using the SimpleConsoleLogger from Logging.Console and it doesn't give the experience we are looking for. Always writing a "info:" prefix clutters the output. Could we add a simpler logger like the one implemented in dotnet/roslyn-tools@c60d28f? |
@JoeRobich big thanks for giving it a try!
In such a case I am going to revert some of my changes and bring back the old behavior, just without using |
| !(OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsTvOS()) | ||
| && !Console.IsOutputRedirected; | ||
|
|
||
| private readonly static object _gate = new object(); |
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 made the gate static, as Console is a static singleton and I expect that we want to prevent from multiple threads changing the color.
| internal class SimpleConsoleLogger : ILogger | ||
| { | ||
| private readonly object _gate = new object(); | ||
| private static readonly bool ColorsAreSupported = |
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.
|
@JoeRobich done, PTAL |
Looks good to me. Thanks! |
* remove the dependency to System.System.CommandLine.Rendering similarly to what I did in dotnet/sdk#46209 * update to latest System.CommandLine * add the missing nuget feed * Apply suggestions from code review

We are no longer going to support System.CommandLine.Rendering.
The
SystemConsolethat was used bydotnet formatwas just a wrapper aroundSystem.Console: https://github.com/dotnet/command-line-api/blob/3bbb940ceeb3254790899d751a8d418348563d40/src/System.CommandLine.Rendering/IO/SystemConsole.cs#L9Since other projects in this repo were already using Microsoft.Extensions.Logging.Console, it felt like the best alternative.