dotnet / dotnet/command-line-api

HelpBuilder failing on windows nanoserver

Offen
#690 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
waiting-on-feedback
Vorherrschende Sprache
C#
Sterne
3.7k
Forks
428
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Creating a `HelpBuilder` instance in windows nanoserver containers will invariably result in unhandled exceptions. For example, if I try to run a console app in a container deriving from `mcr.microsoft.com/dotnet/core/sdk:3.0.100-nanoserver-1809`, I will get the following exception:
```
Unhandled exception. System.IO.IOException: The handle is invalid.
at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.ConsolePal.get_WindowWidth()
at System.Console.get_WindowWidth()
at System.CommandLine.HelpBuilder..ctor(IConsole console, Nullable`1 columnGutter, Nullable`1 indentationSize, Nullable`1 maxWidth)
```

Related to https://github.com/dotnet/corefx/issues/7858. As this is an OS issue, it seems that the best course of action is for System.CommandLine to anticipate the exception and assume a default width (e.g. 80 characters).

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, den Fehler in einem Windows-nanoserver-Container mithilfe einer Konsolenanwendung zu reproduzieren, die einen HelpBuilder erstellt. Untersuche anschließend den Konstruktor von HelpBuilder und den Aufruf von System.Console.WindowWidth, der im Stacktrace angezeigt wird. Erledigt ist die Änderung, wenn HelpBuilder dort keine unbehandelte IOException mehr auslöst und eine Standardbreite wie 80 Zeichen verwendet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.