Public bug reported:

when xsd.exe is used with the /c switch to generate c# code from an existing 
xml schema (.xsd), it handles attributes like the following incorrectly:
<xs:attribute name="setup" type="xs:decimal" default="123"/>

this will generate:
[System.ComponentModel.DefaultValue(123m)]
        [System.Xml.Serialization.XmlAttributeAttribute(Namespace="")]
        public decimal setup {
            get {
                return this.setupField;
            }
            set {
                this.setupField = value;
            }
        }

the important thing is the parameter for the DefaultValue constructor: '123m' 
is added without quotes. i am not entirely sure that it should actually be 
quoted, but if it is not then the compiler bails out with:
error CS0182: An attribute argument must be a constant expression, typeof 
expression or array creation expression
defaults for other types (e.g. integer) are quoted correctly.

this is with the latest mono stuff from 12.04
i.e. 2.10.8.1-1ubuntu1

** Affects: mono (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/966506

Title:
  xsd.exe does not handle default values for xs:decimal correctly

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mono/+bug/966506/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to