[release/8.0] Use invariant culture in CBOR date encoding by github-actions[bot] · Pull Request #92924 · dotnet/runtime (original) (raw)
Backport of #92539 to release/8.0
/cc @eiriktsarpalis @filipnavara
Customer Impact
Since it was released in .NET 5, the System.Formats.Cbor NuGet package included built-in methods for serializing and deserializing DateTimeOffset values according to RFC 7049. Unfortunately, the implementations weren't using invariant culture when formatting/parsing DateTimeOffset values. This can result in inconsistent or even incorrect date encodings in machines with cultures using non-Gregorian calendars.
Even though the bug has been present since the release of the library, consensus is that we'd like this to be backported to .NET 8 so that a fixed LTS release becomes available to customers.
Testing
Adding unit testing validating the fix.
Risk
Moderate. While the product fix is small and straightforward, this is a breaking change for users that rely on the existing behavior to deserialize encodings created by earlier versions of the library. We will document this as a breaking change and provide workarounds, however it was deemed that a compatibility switch is not necessary, given that the library is an out-of-band package that can be updated independently of the framework.