[Mono-bugs] [Bug 540198] New: XContainer.ReplaceNodes doesn't seem to recognise 'IOrderedEnumerable<XElement>'

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 18 06:13:22 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=540198


           Summary: XContainer.ReplaceNodes doesn't seem to recognise
                    'IOrderedEnumerable<XElement>'
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: james.bird at realtimeworlds.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.13)
Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)

Passing an 'IOrderedEnumerable<XElement>' to 'XContainer.ReplaceNodes' doesn't
seem to populate the XContainer with said XElements.

The Mono implementation calls:
-- RemoveNodes();
-- Add(content);

It is as if 'RemoveNodes' is doing the correct thing, but 'Add(content)' is
not...

Note that when running the attached code on the Microsoft implementation of the
class libraries, the XContainer is filled correctly.

Reproducible: Always

Steps to Reproduce:
Run the following code:

using System;
using System.Linq;
using System.Xml.Linq;
using System.IO;
using System.Xml;

namespace LoadXML
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputXml =
"<Foo><C><Three>3</Three><Two></Two><One/></C><B><Aaa/><Yyy/><fff/></B><A
Attrib=\"Hello World\"/></Foo>";
            var reader = XmlTextReader.Create(new StringReader(inputXml), new
XmlReaderSettings());
            XDocument doc = XDocument.Load(reader);
            var result = doc.Root.Elements().OrderBy(el => el.Name.ToString());

            XContainer container = doc.Root;
            container.ReplaceNodes(result);

            Console.WriteLine(container.Elements().Count());
        }
    }
}
Actual Results:  
Number of nodes in 'container' == 0 (when running under Mono)
Number of nodes in 'container' != 0 (when running on Microsoft CLR)

Expected Results:  
Number of nodes in 'container' != 0

-- 
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