Skip to content

Commit 074d050

Browse files
committed
Merge branch 'lmmarsano-fix-attribute-error' into develop
2 parents 690136e + d64451e commit 074d050

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
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();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using System;
2+
3+
[AttributeUsage(AttributeTargets.All)]
4+
class CustomAttribute: Attribute {}

tests/CommandLine.Tests/Fakes/Help_Fakes.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ class Options_With_Usage_Attribute
7979
[Option("secert-option", Hidden = true, HelpText = "This is a description for a secert hidden option that should never be visibile to the user via help text.")]
8080
public string SecertOption { get; set; }
8181

82-
[Usage(ApplicationAlias = "mono testapp.exe")]
82+
[ Custom
83+
, Usage(ApplicationAlias = "mono testapp.exe")
84+
]
8385
public static IEnumerable<Example> Examples
8486
{
8587
get

0 commit comments

Comments
 (0)