[Mono-bugs] [Bug 535449] New: XmlNodeList is reevaluated during iteration

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 29 13:38:15 EDT 2009


           Summary: XmlNodeList is reevaluated during iteration
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: richard.hubers at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv: Gecko/20090729 Firefox/3.5.2

The attached program creates an XmlDocument and loads it with XML. From this
XmlDocument two nodes are selected. They are iterated twice. During the second
iteration of these nodes, the nodes are cloned and the new node is added to the
parent of the node. While the original nodes are not touched (only their
parents are), the collection of nodes is changed during iteration (which
results in an endless loop), possibly because the new nodes conform to the
XPath expression which was used to obtain the XmlNodeList in the first place.
(This is confirmed when adding '[position() <= 2]' to the XPath expression;
then the results are as expected).

Reproducible: Always

Steps to Reproduce:
1. Compile and run the source code provided in the attachment
Actual Results:  
(Console output on Mac OS 10.5)
Nodes: 2
<child a="1" />
<child a="2" />
<child a="1" />
<child a="1" />
<child a="1" />
<child a="1" />
<child a="1" />
<child a="1" />
<child a="1" />

Expected Results:  
(Console output on Microsoft .NET 3.5 SP1)
Nodes: 2
<child a="1" />
<child a="2" />
<child a="1" />
<child a="2" />
<root><child a="1" /><child a="1" /><child a="2" /><child a="2" /></root>

This bug seems similar to https://bugzilla.novell.com/show_bug.cgi?id=495693.

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list