Skip to content

Commit c1e3128

Browse files
author
Josh Peterson
committed
Do not search inherited methods for parameter attributes
It looks like .NET Framework, .NET Core, and previous versions of Mono agree that GetCustomAttributes should not search base class methods looking for attributes on parameters.
1 parent fe9795f commit c1e3128

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mcs/class/corlib/System/MonoCustomAttrs.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ internal static object[] GetCustomAttributes (ICustomAttributeProvider obj, Type
183183
if (inherit && GetBase (obj) == null)
184184
inherit = false;
185185

186+
if (obj is RuntimeParameterInfo)
187+
inherit = false;
188+
186189
// if AttributeType is sealed, and Inherited is set to false, then
187190
// there's no use in scanning base types
188191
if ((attributeType != null && attributeType.IsSealed) && inherit) {

0 commit comments

Comments
 (0)