Fix issue https://github.com/dotnet/coreclr/issues/6600
authorAtsushi Kanamori <atsushik@microsoft.com>
Mon, 15 Aug 2016 13:52:29 +0000 (06:52 -0700)
committerAtsushi Kanamori <atsushik@microsoft.com>
Mon, 15 Aug 2016 13:52:29 +0000 (06:52 -0700)
Return parameters not accomodated in
Attribute.GetParentDefinition(ParameterInfo)

src/mscorlib/src/System/Attribute.cs

index 78fe095..6475d8d 100644 (file)
@@ -220,8 +220,16 @@ namespace System {
                 if (rtMethod != null)
                 {
                     // Find the ParameterInfo on this method
-                    ParameterInfo[] parameters = rtMethod.GetParameters();
-                    return parameters[param.Position]; // Point to the correct ParameterInfo of the method
+                    int position = param.Position;
+                    if (position == -1)
+                    {
+                        return rtMethod.ReturnParameter;
+                    }
+                    else
+                    {
+                        ParameterInfo[] parameters = rtMethod.GetParameters();
+                        return parameters[position]; // Point to the correct ParameterInfo of the method
+                    }
                 }
             }
             return null;