-
Notifications
You must be signed in to change notification settings - Fork 5.1k
System.Reflection.CustomAttributeFormatException thrown on a retrieval of derived attribute with overridden property getter #117584
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
base: main
Are you sure you want to change the base?
Conversation
…l of derived attribute with overridden property getter
@@ -107,7 +107,7 @@ public static Attribute Instantiate(this CustomAttributeData cad) | |||
for (; ; ) | |||
{ | |||
PropertyInfo? propertyInfo = walk.GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly); | |||
if (propertyInfo != null) | |||
if (propertyInfo?.SetMethod is not null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this logic equivalent to the others, or just equivalent enough to pass the test? What corner cases are we missing in the test that necessitate the more complex logic elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was going to be off for a few days so I did rapidely just enough to pass the test and not let the PR hanging, I fixed it now. The missing condition stops the lookup in base classes early if someone used the new keyword to hide the property instead of overriding it.
Fixes #110412
Sorry for the delay, I've been busy these last weeks