Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Newtonsoft.Json dependency #1707

Merged
merged 2 commits into from
Oct 15, 2021

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Oct 1, 2021

Instead, use System.Text.Json everywhere.

JSON Configuration File

Since there's no equivalent to MissingMemberHandling with System.Text.Json, the error messages in case of erroneous keys in the JSON configuration file have been improved. For example, if you have a typo in the enabled key you would get this error:

The allowed keys for the "stryker-config.since" object are { "enabled", "ignore-changes-in", "target" } but "enable" was found in the config file at "[…]/tests/stryker-config.json"

Those better error messages also required to have a JsonPropertyName attribute on all the properties. This is probably a good thing anyway since it makes the code more greppable.

Newtonsoft.Json transitive dependency

Unfortunately, Newtonsoft.Json is still there transitively (through Buildalyzer/3.2.2 → Microsoft.Extensions.DependencyModel/2.1.0 → Newtonsoft.Json/9.0.1) but there's nothing we can do about it for now, see microsoft/vstest#2488 (comment) for a full explanation.

Instead, use System.Text.Json everywhere.

### JSON Configuration File

Since there's [no equivalent][1] to `MissingMemberHandling` with `System.Text.Json`, the error messages in case of erroneous keys in the JSON configuration file have been improved. For example, if you have a typo in the `enabled` key you would get this error:

> The allowed keys for the "stryker-config.since" object are { "enabled", "ignore-changes-in", "target" } but "enable" was found in the config file at "[…]/tests/stryker-config.json"

Those better error messages also required to have a `JsonPropertyName` attribute on _all_ the properties. This is probably a good thing anyway since it makes the code more _greppable_.

### Newtonsoft.Json transitive dependency

Unfortunately, `Newtonsoft.Json` is still there transitively (through Buildalyzer/3.2.2 → Microsoft.Extensions.DependencyModel/2.1.0 → Newtonsoft.Json/9.0.1) but there's nothing we can do about it for now, see microsoft/vstest#2488 (comment) for a full explanation.

[1]: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to#missingmemberhandling
@rouke-broersma
Copy link
Member

Apologies on the delay. we'll look into this pr tomorrow.

@rouke-broersma rouke-broersma merged commit 89d6379 into stryker-mutator:v1.0 Oct 15, 2021
@0xced 0xced deleted the remove-newtonsoft branch October 16, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants