dotnet / dotnet/command-line-api

HelpBuilder failing on windows nanoserver

Open
#690 1 comment 0 reactions 0 assignees View on GitHub
waiting-on-feedback
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.