}
[Fact]
- [ActiveIssue(@"https://github.com/dotnet/runtime/issues/6445")]
public void GetCustom_Attribute_On_Return_Parameter_On_Parent_Method()
{
Type type = typeof(TestClass_P_Derived);
MethodInfo miWithReturnAttribute = type.GetTypeInfo().GetDeclaredMethod("methodWithReturnAttribute");
ParameterInfo returnParameter = miWithReturnAttribute.ReturnParameter;
- MyAttribute_Single_P attribute = CustomAttributeExtensions.GetCustomAttribute<MyAttribute_Single_P>(returnParameter, inherit: true);
+ MyAttribute_Single_Inherited_P attribute = CustomAttributeExtensions.GetCustomAttribute<MyAttribute_Single_Inherited_P>(returnParameter, inherit: true);
Assert.NotNull(attribute);
}
}
MyAttribute_AllowMultiple_Inherited_P("multiple")] int param)
{ }
- [return: MyAttribute_Single_P("single")]
+ [return: MyAttribute_Single_Inherited_P("single")]
public virtual byte methodWithReturnAttribute() { return 0; }
}
<Compile Include="GetCustomAttributes_Assembly.cs" />
<Compile Include="GetCustomAttributes_Compat.cs" />
<Compile Include="GetCustomAttributes_MemberInfo.cs" />
- <Compile Include="GetCustomAttributes_ParamterInfo.cs" />
+ <Compile Include="GetCustomAttributes_ParameterInfo.cs" />
<Compile Include="ReflectionTestExtensions.cs" />
<Compile Include="RuntimeReflectionExtensionTests.cs" />
<Compile Include="RuntimeReflectionExtensionTestsWithQuirks.cs" />
MethodInfo bmethod = ((RuntimeMethodInfo)method).GetBaseMethod();
if (bmethod == method)
return null;
- return bmethod.GetParameters()[parinfo.Position];
+ int position = parinfo.Position;
+ if (position == -1)
+ return bmethod.ReturnParameter;
+ return bmethod.GetParameters()[position];
}
}
/*