NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Add DateOnly support to XmlSerializer

Open sliekens opened this issue 1 year ago • 1 comments

Describe the feature.

Add the ability to serialize DateOnly (and TimeOnly) to and from XML.

Is your feature related to a problem? Please describe.

The XmlSerializer will happily write DateOnly to XML by calling ToString() (not an ISO format).

The receiving end then crashes with an exception:

image

Thrown from this code: https://github.com/Particular/NServiceBus/blob/16511c5f32a36f6c128324abfdfd6a2bfb871ca3/src/NServiceBus.Core/Serializers/XML/XmlDeserialization.cs#L490

Describe the requested feature

Serialize DateOnly to yyyy-MM-dd

Describe alternatives you've considered

  • Migrate to JSON messages, but that is a larger effort, doesn't make sense in my current environment, maybe later
  • Use DateTime, but time zones scare me
  • Use string and parse the DateOnly myself, thanks but no thanks

Additional Context

No response

sliekens avatar Jul 30 '24 09:07 sliekens

Thank you for submitting the feature request - we will consider it in a future platform enhancement release. In the meantime, we have updated our documentation to reflect that DateOnly is currently not supported.

jpalac avatar Jul 31 '24 04:07 jpalac