dotnet / dotnet/command-line-api

Type mismatch between string and string array to error out

Aperta
#787 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Area-Parser and Binder
Lingua principale
C#
Stelle
3.7k
Fork
428
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
40/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.