[Mono-bugs] [Bug 398592] New: Appending an attribute twice throws runtime error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jun 9 11:45:07 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=398592


           Summary: Appending an attribute twice throws runtime error
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: petee at mindtouch.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Using this testcase:

using System;
using System.Text;
using System.Xml;

namespace bug {
        public class Test {
                static void Main(string[] args) {
                        XmlDocument doc = new XmlDocument();
                        XmlElement root = doc.CreateElement("root");
                        doc.AppendChild(root);

                        XmlElement child1 = doc.CreateElement("child1");
                        XmlAttribute attr = doc.CreateAttribute("name");
                        attr.Value = "value";
                        root.AppendChild(child1);
                        child1.Attributes.Append(attr);

                        XmlElement child2 = doc.CreateElement("child2");
                        root.AppendChild(child2);
                        child2.Attributes.Append(attr);
                        doc.WriteTo(new XmlTextWriter(Console.Out));
                }
        }
}


Mono gives this result:
petee at mindtouch04:~$ ~/mono-trunk/bin/mono xml-attribute-bug.exe 

Unhandled Exception: System.ArgumentException: This attribute is already set to
another element.
  at System.Xml.XmlAttributeCollection.SetNamedItem (System.Xml.XmlNode node)
[0x00000] 
  at System.Xml.XmlAttributeCollection.Append (System.Xml.XmlAttribute node)
[0x00000] 
  at bug.Test.Main (System.String[] args) [0x00000]


MS Runtime:

C:\Program Files\Microsoft Visual Studio 8\VC>xml-attribute-bug.exe
<root><child1 /><child2 name="value" /></root>


-- 
Configure bugmail: https://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