[Mono-bugs] [Bug 539727] New: XAttribute initialized with boolean value cannot be round-tripped

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Sep 16 14:34:09 EDT 2009


           Summary: XAttribute initialized with boolean value cannot be
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Major
          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_8; en-us)
AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9

An expression of the form

new XAttribute("blah", true)

Generates an XAttribute whose value is the string "True", rather than "true".
This, in turn, will cause an explicit conversion from XAttribute to bool to
fail because the conversion method passes the unmodified string value to
XmlConvert.ToBoolean (which insists on lower-case input).

Microsoft's implementation, on the other hand, will generate an XAttribute
whose value is the string "true". Additionally, their implementation appears to
make the string lowercase before passing it to XmlConvert.ToBoolean, which
allows XAttributes with values of "true", "True", and "TRUE" to be converted
successfully to boolean values.

Reproducible: Always

Steps to Reproduce:
1. Create an XAttribute with a bool as the value
2. Explicitly convert the XAttribute to bool.
Actual Results:  
the XAttribute is given the value "True" (or "False") and a
System.FormatException is thrown upon conversion to bool.

Expected Results:  
the XAttribute should be given the value of "true" (or "false"), and conversion
to bool should be case insensitive, allowing for string values of "True",
"TRUE", "False", and "FALSE" to all be successfully converted.

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