dotnet / dotnet/command-line-api

Type mismatch between string and string array to error out

Offen
#787 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Area-Parser and Binder
Vorherrschende Sprache
C#
Sterne
3.7k
Forks
428
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Noticed at https://github.com/dotnet/format/pull/551#discussion_r379924103, if `option.Argument = new Argument(() => null)` is used and the target delegate's signature has `string[]`, it can be an error so the user knows that API is not going to work as expected.

```
myApp --myStringArrayArg val1 val2 val3
```

will only function properly at runtime with `option.Argument = new Argument(() => null)`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the Argument and Argument cases described in the issue, then trace how the target delegate signature is checked during invocation. Reproduce the myApp --myStringArrayArg val1 val2 val3 scenario and verify that using Argument with a string[] delegate produces a clear error instead of silently failing at runtime.

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
40/100

Neue Issues direkt in Ihr Postfach

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