[Mono-bugs] [Bug 479725] New: XmlWriter.WriteAttributeString() fails to throw exceptions when asked to redefine namespaces.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 25 17:28:27 EST 2009


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


           Summary: XmlWriter.WriteAttributeString() fails to throw
                    exceptions when asked to redefine namespaces.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          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: dmitchell at logos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

Here's some code:

---
using System;
using System.IO;
using System.Xml;

public static class Program
{
    public static void Main()
    {
        int exceptionCount = 0;

        try
        {
            using (StringWriter writerString = new StringWriter())
            using (XmlWriter writerXml = XmlWriter.Create(writerString))
            {
                writerXml.WriteStartElement("HI", null);
                writerXml.WriteAttributeString("xmlns", "test");
                writerXml.WriteEndElement();
            }
        }
        catch (XmlException)
        {
            exceptionCount++;
        }

        try
        {
            using (StringWriter writerString = new StringWriter())
            using (XmlWriter writerXml = XmlWriter.Create(writerString))
            {
                writerXml.WriteStartElement("x", "HI", "http://www.x.com");
                writerXml.WriteAttributeString("xmlns", "x", null,
"http://www.y.com");
                writerXml.WriteEndElement();
            }
        }
        catch (XmlException)
        {
            exceptionCount++;
        }

        Console.WriteLine("{0} exceptions thrown.", exceptionCount);
    }
}
---
If you build/run this on Microsoft's .NET implementation, it reports that two
exceptions are thrown. However, no exceptions are thrown if the code is
built/run under Mono.

Reproducible: Always

Steps to Reproduce:
1. Build the included code
2. Execute the resulting assembly
3.
Actual Results:  
No exceptions are thrown

Expected Results:  
Two XmlExceptions should be thrown.

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