[ubuntu-mono] [Bug 966506] [NEW] xsd.exe does not handle default values for xs:decimal correctly

Stefan Tauner 966506 at bugs.launchpad.net
Tue Mar 27 19:26:55 UTC 2012


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
CLI/Mono Uploaders, which is subscribed to mono in Ubuntu.
https://bugs.launchpad.net/bugs/966506

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

Status in “mono” package in Ubuntu:
  New

Bug description:
  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

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



More information about the Ubuntu-mono mailing list