InstallationDate of installed packages is mangled when installing other packages
Created:
3/31/2021 5:33:15 AM by wldevries
Status:
closed on 3/31/2021 2:56:53 PM
Last pulled:
3/31/2021 2:56:53 PM
Description:
Newtonsoft.Json has the annoying design decision to parse dates as dates when possible. Due to the way the registered packages are deserialized and reserialized when calling `PackageRegistry.RegisterPackageAsync` all dates of previously registered packages are parsed and reformatted using the default date formatter.
https://github.com/JamesNK/Newtonsoft.Json/issues/862
I expect other fields to get the exact same treatment and this would be extremely bad if it happened to a `group` or `name` field that is parsable as a `DateTime`.
This can be fixed by either fixing #21 not only for NET Core 3.1, but for all targets supporting System.Text.Json. Another option could be to not rely on dynamic deserialization in Newtonsoft.Json.
**Steps to reproduce**
1. Register a package using .NET reversible format `o`
2. Register a second package using .NET reversible format `o`
**Expected result**
Both packages are listed in `installedPackages.json` with the date provided to the `RegisterPackageAsync` method.
**Actual result**
The `installedDate` of the first package is mangled and changed into the default date format (MM-dd-YYYY) instead of the actual string.