Skip to content

Commit 196a830

Browse files
committed
pass custom attribute test
in ReflectionExtensions.GetUsageData, filter attributes by type before casting to that type
1 parent 64414d9 commit 196a830

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CommandLine/Core/ReflectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public static Maybe<Tuple<PropertyInfo, UsageAttribute>> GetUsageData(this Type
4040
{
4141
return
4242
(from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties())
43-
let attrs = pi.GetCustomAttributes(true)
44-
where attrs.OfType<UsageAttribute>().Any()
43+
let attrs = pi.GetCustomAttributes(typeof(UsageAttribute), true)
44+
where attrs.Any()
4545
select Tuple.Create(pi, (UsageAttribute)attrs.First()))
4646
.SingleOrDefault()
4747
.ToMaybe();

0 commit comments

Comments
 (0)