[Mono-bugs] [Bug 77194][Nor] Changed - System.XML.XPath's Iterator
is buggy?
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jan 11 13:39:43 EST 2006
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 atsushi at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77194
--- shadow/77194 2006-01-11 05:57:21.000000000 -0500
+++ shadow/77194.tmp.18227 2006-01-11 13:39:43.000000000 -0500
@@ -1,13 +1,13 @@
Bug#: 77194
Product: Mono: Class Libraries
Version: 1.1
OS: All
OS Details: OSX 10.4.3 and Ubuntu Dapper
-Status: REOPENED
-Resolution:
+Status: RESOLVED
+Resolution: NOTABUG
Severity: Unknown
Priority: Normal
Component: Sys.XML
AssignedTo: atsushi at ximian.com
ReportedBy: richard.torkar at htu.se
QAContact: mono-bugs at ximian.com
@@ -275,6 +275,80 @@
aha, am so stupid ;-) Thanks, lemme try them later.
------- Additional Comments From richard.torkar at htu.se 2006-01-11 05:57 -------
God knows, my brain isn't always remembering stuff either ;-) Thanks
for the quick replies Atsushi!
+
+------- Additional Comments From atsushi at ximian.com 2006-01-11 13:39 -------
+That error is thrown when the argument XPathNavigator implementation
+(this case DotNetGuru.AspectDNG.XPath.Navigator) is buggy enough to
+fail to move to parent nodes by MoveToParent().
+
+In other words, DescendantOrSelfIterator is kind enough to report
+users' XPathNavigator implementation bugs. Microsoft implementation
+would just ignore such cases and it returns false (and users won't
+understand what is going on there).
+
+AspectDNG XPathNavigator is buggy. At the first call to
+Navigator.MoveToFirstChild() changes the state from Root to Element
+(pointing to m_rootElement). But when Navigator.MoveToParent() is
+invoked, it just tries to get "Parent" of m_rootElement and thus it
+never moves to Root state.
+
+To verify my conviction ;-) you can try this patch to system.xml
+below. Build (without install) and run
+MONO_PATH=/path/to/your_own_build/mcs/class/lib/default mono
+aspectdng.exe mySample.exe myAspects.dll
+
+
+Index: System.Xml.XPath/Iterator.cs
+===================================================================
+--- System.Xml.XPath/Iterator.cs (revision 55374)
++++ System.Xml.XPath/Iterator.cs (working copy)
+@@ -555,9 +555,11 @@
+ Current.MoveTo (_nav);
+ return true;
+ }
++Console.Error.Write ("**** {3} now node is {0} {1} {2}",
+_nav.NodeType, _nav.LocalName, _nav.NamespaceURI, _nav.GetHashCode ());
+ if (_nav.MoveToFirstChild ())
+ {
+ _depth ++;
++Console.Error.WriteLine ("/ moved to first child, depth is now at : "
++ _depth);
+ Current.MoveTo (_nav);
+ return true;
+ }
+@@ -569,8 +571,9 @@
+ return true;
+ }
+ if (!_nav.MoveToParent ()) // should NEVER fail!
+- throw new XPathException ("There seems some bugs on the
+XPathNavigator implementation class.");
++ throw new XPathException ("There seems some bugs on the
+XPathNavigator implementation class:" + _nav.GetType ());
+ _depth --;
++Console.Error.WriteLine (" / moved to parent, depth is now at " +
+_depth + ", nav is {0} {1} {2}", _nav.NodeType, _nav.LocalName,
+_nav.NamespaceURI);
+ }
+ _finished = true;
+ return false;
+
+Here is the fix for aspectdng. After this fix it should work fine (of
+course feel free to feedback it to aspectdng guys):
+
+ public override bool MoveToParent() {
+ if (m_NodeType == XPathNodeType.Root)
+ return false;
+
+ if (m_CurrentElement.Parent != null){
+ MoveTo(m_CurrentElement.Parent);
+ }
+ else {
+ m_CurrentElement = m_RootElement;
+ m_NodeType = XPathNodeType.Root;
+ }
+ return true;
+ }
+
More information about the mono-bugs
mailing list