commandlineparser / commandlineparser/commandline
"help" crashes when mixing UsageAttribute with other Attributes
- Vorherrschende Sprache
- C#
- Sterne
- 4.8k
- Forks
- 478
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**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();
}
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.