http://bugzilla.novell.com/show_bug.cgi?id=495693
Summary: Modifying XML dom while iterating over it using
foreach displays different behavior to .NET
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: i686
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.XML
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
Found By: ---
Created an attachment (id=286226)
--> (http://bugzilla.novell.com/attachment.cgi?id=286226)
Test code Showing different behaviour modifying dom while looping over it with
foreach
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8)
Gecko/2009032711 Ubuntu/8.04 (hardy) Firefox/3.0.8
Attached code sample showing problem.
basically for some XML this works in .NET:
foreach (XmlNode includeNode in doc.SelectNodes("//mynode"))
{
XmlNode parentNode = includeNode.ParentNode;
parentNode.AppendChild(newNode);
}
I acknowledge this code is horrible, but given it differs from .NET behavior, I
believe its a bug.
Reproducible: Always
Steps to Reproduce:
1. Compile and run attached test code
2.
3.
Actual Results:
Infinite loop.
Expected Results:
blah/drinks1
hello world
New List
blah/drinks1
blah/drinks12
hello world
hello world2
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs