Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono.Options] CommandSet and PCL/NetStandard Support (#4719)
When `PCL` is defined, the intent is that the resulting `Mono.Options.dll` assembly will be usable on all PCL profiles. This includes "silly" profiles such as Profile259, which lacks the `System.Console` type, meaning e.g. `Console.Out` doesn't exist. Unfortunately, the `CommandSet(string, Converter<string, string, TextWriter, TextWriter)` constructor would use `Console.Out` and `Console.Error` when the `TextWriter` parameters were `null`, meaning this constructor can't be provided for all PCL profiles. Altering the constructor to instead use `TextWriter.Null` would allow the constructor to be provided, but would be a *worse* experience, IMHO: anybody (everybody!) expecting the default values to "do something useful" will be sorely disappointed, as output and error messages would instead be dropped. :-( Instead, remove this constructor: public CommandSet (string suite, MessageLocalizerConverter localizer = null, TextWriter output = null, TextWriter error = null); and replace it with these *two* constructors: public CommandSet (string suite, MessageLocalizerConverter localizer = null) public CommandSet (string suite, TextWriter output, TextWriter error, MessageLocalizerConverter localizer = null) The first constructor, which accepts no `TextWriter` parameters, is only provided in non-PCL builds, allowing it to use `Console.Out`. The second constructor is available in PCL profiles, and *requires* that `output` and `error` be non-`null`. Documentation has been updated accordingly.
- Loading branch information
Showing with 72 additions and 14 deletions.