Skip to content

Commit 2ddd35a

Browse files
committed
Ignore inherit param for ParameterInfo.GetCustomAttributes
It is documented that the inherit flag is ignored. Attribute.GetCustomAttributes is to be used to search inheritance chain. This change is only for the Mono classlib implementation. CoreCLR already has this behavior.
1 parent f4c2bab commit 2ddd35a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mcs/class/corlib/System.Reflection/RuntimeParameterInfo.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,20 @@ int MetadataToken {
192192
override
193193
object[] GetCustomAttributes (bool inherit)
194194
{
195-
return MonoCustomAttrs.GetCustomAttributes (this, inherit);
195+
// It is documented that the inherit flag is ignored.
196+
// Attribute.GetCustomAttributes is to be used to search
197+
// inheritance chain.
198+
return MonoCustomAttrs.GetCustomAttributes (this, false);
196199
}
197200

198201
public
199202
override
200203
object[] GetCustomAttributes (Type attributeType, bool inherit)
201204
{
202-
return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
205+
// It is documented that the inherit flag is ignored.
206+
// Attribute.GetCustomAttributes is to be used to search
207+
// inheritance chain.
208+
return MonoCustomAttrs.GetCustomAttributes (this, attributeType, false);
203209
}
204210

205211
internal object GetDefaultValueImpl (ParameterInfo pinfo)

0 commit comments

Comments
 (0)