You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm updating an application that used a version of CommandLineUtils from before b92f20e, and it correctly handled attribute overrides through the built-in [AttributeUsage(Inherited = true)] system (an attribute present on a subclass would completely replace one on the superclass). Now, I get a duplicate attribute error because the same property is detected and returned twice, from the subclass and the superclass.
More specifically, the patch needs to iterate over each BaseType (walking up the class hierarchy) to find private members because they are not included in subtype.GetProperties(BindingFlags.NonPublic). The author included the additional flag BindingFlags.DeclaredOnly to fix the obvious issue with inheritance (the method would return spurious duplicate members on all inherited classes), but missed the case where the subclass is overriding something that is declared in both classes - in which case we should only take the most specific instance.
Previously, the property in the base class and the property in the subclass would both be returned, causing us to complain about duplicate arguments/options that are actually the same.
Closesnatemcmaster#555
I'm updating an application that used a version of CommandLineUtils from before b92f20e, and it correctly handled attribute overrides through the built-in
[AttributeUsage(Inherited = true)]
system (an attribute present on a subclass would completely replace one on the superclass). Now, I get a duplicate attribute error because the same property is detected and returned twice, from the subclass and the superclass.More specifically, the patch needs to iterate over each
BaseType
(walking up the class hierarchy) to find private members because they are not included insubtype.GetProperties(BindingFlags.NonPublic)
. The author included the additional flagBindingFlags.DeclaredOnly
to fix the obvious issue with inheritance (the method would return spurious duplicate members on all inherited classes), but missed the case where the subclass is overriding something that is declared in both classes - in which case we should only take the most specific instance.Related issues:
The text was updated successfully, but these errors were encountered: