commandlineparser / commandlineparser/commandline
"help" crashes when mixing UsageAttribute with other Attributes
- Lingua principale
- C#
- Stelle
- 4.8k
- Fork
- 478
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Issue by [LarsWeuste](https://github.com/LarsWeuste)**
_Friday May 19, 2017 at 10:47 GMT_
_Originally opened as https://github.com/gsscoder/commandline/issues/443_
----
When using the "Usage" attribute together with a 2nd one (e.g. ExcludeFromCoverage) like this:
[Usage]
[ExcludeFromCodeCoverage]
public static IEnumerable Examples ...
In this situation displaying "help" will cause an exception.
The cause for that is likely fixed by this change:
src/CommandLine/Core/ReflectionExtensions.cs: L45
public static Maybe> GetUsageData(this Type type)
{
return
(from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties())
let attrs = pi.GetCustomAttributes(true)
where attrs.OfType().Any()
select Tuple.Create(pi, (UsageAttribute)attrs.OfType().First()))
.SingleOrDefault()
.ToMaybe();
}
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.