mail-archives/mono-bugs/2002-February/000033.html

147 строки
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 21099] Changed - Interface member lookup problem
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40rocky.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="000032.html">
<LINK REL="Next" HREF="000034.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 21099] Changed - Interface member lookup problem
</H1>
<B>bugzilla-daemon@rocky.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40rocky.ximian.com"
TITLE="[Mono-bugs] [Bug 21099] Changed - Interface member lookup problem">bugzilla-daemon@rocky.ximian.com
</A><BR>
<I>27 Feb 2002 17:46:28 -0000</I>
<P><UL>
<LI> Previous message: <A HREF="000032.html">[Mono-bugs] [Bug 21072] Changed - Crash compiling a constant variable of Enum type
</A></li>
<LI> Next message: <A HREF="000034.html">[Mono-bugs] [Bug 21145] New - Type lookup problem in delegate declaration
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#33">[ date ]</a>
<a href="thread.html#33">[ thread ]</a>
<a href="subject.html#33">[ subject ]</a>
<a href="author.html#33">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:f_ai@hotmail.com.">f_ai@hotmail.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=21099">http://bugzilla.ximian.com/show_bug.cgi?id=21099</A>
--- 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: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
ReportedBy: <A HREF="mailto:f_ai@hotmail.com">f_ai@hotmail.com</A>
QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
TargetMilestone: ---
@@ -43,6 +43,65 @@
{
p.method2();//&lt;- works declared in 'B'
p.method1();//&lt;- fails declared in 'A'
}
}
}
+
+------- Additional Comments From <A HREF="mailto:f_ai@hotmail.com">f_ai@hotmail.com</A> 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 &amp; 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 &amp; 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.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="000032.html">[Mono-bugs] [Bug 21072] Changed - Crash compiling a constant variable of Enum type
</A></li>
<LI> Next message: <A HREF="000034.html">[Mono-bugs] [Bug 21145] New - Type lookup problem in delegate declaration
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#33">[ date ]</a>
<a href="thread.html#33">[ thread ]</a>
<a href="subject.html#33">[ subject ]</a>
<a href="author.html#33">[ author ]</a>
</LI>
</UL>
</body></html>