NServiceBus
NServiceBus copied to clipboard
Add DateOnly support to XmlSerializer
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:
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
stringand parse theDateOnlymyself, thanks but no thanks
Additional Context
No response
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.