[Mono-bugs] [Bug 21099] Changed - Interface member lookup problem
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
27 Feb 2002 17:46:28 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by f_ai@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=21099
--- shadow/21099 Tue Feb 26 16:06:40 2002
+++ shadow/21099.tmp.8521 Wed Feb 27 12:46:28 2002
@@ -1,14 +1,14 @@
Bug#: 21099
Product: Mono/MCS
Version: unspecified
-OS:
+OS: unknown
OS Details:
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Minor
Component: Misc
AssignedTo: mono-bugs@ximian.com
ReportedBy: f_ai@hotmail.com
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
@@ -43,6 +43,65 @@
{
p.method2();//<- works declared in 'B'
p.method1();//<- fails declared in 'A'
}
}
}
+
+------- Additional Comments From f_ai@hotmail.com 2002-02-27 12:46 -------
+The method 'Interface.FindMembers' never attempts to find the
+requested member on the parent interfaces (in the case the interface
+inherits from another) and this is probably the source of the
+problem. We could change the code by adding:
+
+// Lookup members in parent interfaces.
+if ((bf & BindingFlags.DeclaredOnly) == 0)
+{
+ foreach (string name in Bases)
+ {
+ MemberInfo [] mi;
+ Type iType;
+ Interface ibase;
+
+ /*
+ * Locate the actual base interface type, so we can
+get it's FullName,
+ * I think that is not required to
+call 'GetInterfaceTypeByName' because
+ * all the bases must have been resolved already,
+may be it is better
+ * to keep a cash of all this bases Types once they
+are calculated so
+ * this does not have to be done all the time.
+ */
+
+ iType = RootContext.LookupType(this, name, true,
+Location);
+ if (iType == null)
+ continue;//this should never happen (check
+if this is true)
+
+ /*
+ * now that i have the FullName, i can just grab the
+object
+ * from the Interfaces List.
+ */
+
+ ibase = (Interface) RootContext.Tree.Interfaces
+[iType.FullName];
+ if (ibase == null)
+ continue;//this should never happen (check
+if this is true)
+
+ // Query the parent interface for the 'member'
+ mi = ibase.FindMembers(mt, bf, filter, criteria);
+ if (mi != null)
+ members.AddRange (mi);
+ }
+}
+
+Now this code as it is will not fix the problem, this method is
+never called with '(bf & BindingFlags.DeclaredOnly) == 0'.
+
+I don't know if the caller should be changed when resolving an
+invoke or if the flag is meaningless in this context, so further
+work is required, but i think is closer now.