Bug 13049 - DataTypeAttribute differs between Mono and MS.NET
Summary: DataTypeAttribute differs between Mono and MS.NET
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-07-04 04:31 UTC by Eddy Zavaleta
Modified: 2014-12-09 08:22 UTC (History)
2 users (show)

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


Attachments
A little program that prints DisplayFormat properties. (1.79 KB, application/octet-stream)
2013-07-04 04:31 UTC, Eddy Zavaleta
Details
Proposed fix (1.37 KB, patch)
2013-07-04 04:36 UTC, Eddy Zavaleta
Details


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:
Status:
RESOLVED FIXED

Description Eddy Zavaleta 2013-07-04 04:31:11 UTC
Created attachment 4268 [details]
A little program that prints DisplayFormat properties.

Hi,

I found an inconsistency in DataTypeAttribute (System.ComponentModel.DataAnnotations) between Mono and MS.NET when using DataType.Date, DataType.Time and DataType.Currency. I noticed this when I was running an ASP.NET MVC application and the currency values were displayed as plain decimal numbers.

Exploring DisplayFormat properties in DataTypeAttribute for each DataType value I get the following results using the attached program.

MS.NET output:

== DataTypeAttribute(DataType.Date) ==
DisplayFormat:
 ApplyFormatInEditMode: True
 ConvertEmptyStringToNull: True
 DataFormatString: {0:d}
 NullDisplayText: null
 HtmlEncode: True

== DataTypeAttribute(DataType.Time) ==
DisplayFormat:
 ApplyFormatInEditMode: True
 ConvertEmptyStringToNull: True
 DataFormatString: {0:t}
 NullDisplayText: null
 HtmlEncode: True

== DataTypeAttribute(DataType.Currency) ==
DisplayFormat:
 ApplyFormatInEditMode: False
 ConvertEmptyStringToNull: True
 DataFormatString: {0:C}
 NullDisplayText: null
 HtmlEncode: True

Mono 3.0.12 output:

== DataTypeAttribute(DataType.Date) ==
DisplayFormat Is Null

== DataTypeAttribute(DataType.Time) ==
DisplayFormat:
 ApplyFormatInEditMode: True
 ConvertEmptyStringToNull: True
 DataFormatString: {0:t}
 NullDisplayText: null
 HtmlEncode: False

== DataTypeAttribute(DataType.Currency) ==
DisplayFormat Is Null
Comment 1 Eddy Zavaleta 2013-07-04 04:36:11 UTC
Created attachment 4269 [details]
Proposed fix

This patch adds the missing info for DisplayFormat property in DataTypeAttribute.
Comment 2 Marek Safar 2014-12-09 08:22:29 UTC
Fixed in master