New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribute.CoreCLR, redundant check #78683
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsThe code: public static Attribute? GetCustomAttribute(ParameterInfo element, Type attributeType, bool inherit)
{
// ....
Attribute[] attrib = GetCustomAttributes(element, attributeType, inherit);
if (attrib == null || attrib.Length == 0) // <=
return null;
if (attrib.Length == 0) // <=
return null;
if (attrib.Length == 1)
return attrib[0];
throw new AmbiguousMatchException(SR.RFLCT_AmbigCust);
} The
|
The code:
Link to the sources
The
attrib.Length == 0
expression is checked twice. Perhaps it's not an error and just redundant code.Could you check it?
The text was updated successfully, but these errors were encountered: