Bug 4668 - xsd does not handle defaults for decimal types correctly
Summary: xsd does not handle defaults for decimal types correctly
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-04-26 11:33 UTC by Stefan Tauner
Modified: 2013-08-09 04:04 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

xml schema (385 bytes, application/octet-stream)
2012-04-26 11:34 UTC, Stefan Tauner
produced, invalid code (1.37 KB, application/octet-stream)
2012-04-26 11:34 UTC, Stefan Tauner

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Stefan Tauner 2012-04-26 11:33:40 UTC
i am using xsd to generate classes from an xml schema. setting a default value for xs:decimal types fails to generate valid code:
note the missing quotes around the parameter.

i am attaching an xsd test case (and later the generated code from my machine).
the command used to generate the class from the xsd is:
xsd decimaldefault.xsd /c

this generates the file "decimaldefault.cs", which can (not) be compiled with:
gmcs -t:library decimaldefault.cs

the output of gmcs is:
decimaldefault.cs(29,48): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression
Compilation failed: 1 error(s), 0 warnings

i am using the mono packages version of ubuntu 12.04 which include
Comment 1 Stefan Tauner 2012-04-26 11:34:24 UTC
Created attachment 1754 [details]
xml schema
Comment 2 Stefan Tauner 2012-04-26 11:34:46 UTC
Created attachment 1755 [details]
produced, invalid code
Comment 3 Atsushi Eno 2013-08-09 04:04:54 UTC
Fixed in git master [53a68c9].