-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Replace JsonSerializer with DataContractJsonSerializer in Microsoft.Toolkit.Uwp. #3637
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
Conversation
Thanks RosarioPulella for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
Awesome, that seems pretty straight-forward. Have you tested the update scenario for Outside of that it's just release notes and documentation. Adding the 'breaking changes' label here for tracking when we write the release notes as this could cause changes for developers that are doing more complex scenarios (but we have mitigation). |
@RosarioPulella CI failed - looks like some tests need updating? (Or maybe a sign that we broke something?) |
I am not sure how to initialize an app using the old version of the lib in a unit test with the new lib also included in the same proj. I am looking into including the old package |
It seems like I would have to build and run an app with |
Is there any impact on the final binary size ? |
@vgromfeld we were still seeing the dlls included in the SmokeTest apps and report? |
Added legacy public class read test. Add public class for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely want to ensure we document these changes. But I think as we said as long we've tested SystemInformation
we can always guide developers to use the previous Newtonsoft or System.Text.Json for compatibility.
Hello @michael-hawker! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs
Outdated
Show resolved
Hide resolved
…elper.cs Co-authored-by: Michael Hawker MSFT (XAML Llama) <[email protected]>
…Helper.cs Co-authored-by: Michael Hawker MSFT (XAML Llama) <[email protected]>
…geHelper.cs Co-authored-by: Michael Hawker MSFT (XAML Llama) <[email protected]>
@msftbot merge when @vgromfeld approves |
Hello @michael-hawker! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
@@ -47,6 +47,7 @@ | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="System.ValueTuple" Version="4.5.0" /> | |||
<PackageReference Include="System.Text.Json" Version="4.7.2" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<PackageReference Include="System.Text.Json" Version="4.7.2" /> | |
<PackageReference Include="System.Text.Json" Version="4.7.2" /> |
Fallow up to #3637 Applying #3637 (comment)
## Fixes #3692 This introduces a new light-weight serializer which we can use within the toolkit for the `SystemInformation` class still. And then developers with more complex type needs can specify their own serializer for the `BaseObjectStorageHelper` classes. See the related issue for more details. Follow-on to #3637 and #3414 ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> <!-- - Bugfix --> - Feature <!-- - Code style update (formatting) --> - Refactoring (no functional changes, no api changes) <!-- - Build or CI related changes --> <!-- - Documentation content changes --> <!-- - Sample app changes --> <!-- - Other... Please describe: --> ## What is the current behavior? Using `DataContractJsonSerializer`, though we had used `Newtonsoft.Json` in 6.1. ## What is the new behavior? Use new `SystemSerializer` which passes values to/from the Windows `ApplicationDataContainer` APIs directly. Updates our internal usages of this to the new system. Requires developer using the `BaseObjectStorageHelper` to provide a serializer implementation. This of course does provide a 'default'/system information within the toolkit now compared to our original thought of providing none at all before the `SystemInformation` problem was identified. ## PR Checklist Please check if your PR fulfills the following requirements: - [x] Tested code with current [supported SDKs](../readme.md#supported) - [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link --> - [ ] Sample in sample app has been added / updated (for bug fixes / features) - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) - [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/windows-toolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc... - [ ] Tests for the changes have been added (for bug fixes / features) (if applicable) - [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [ ] Contains **NO** breaking changes <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. --> ## Other information I tested copying the system.dat file from the Settings folder of our 6.1 sample app to the development version with the changes, no issues with `SystemInformation` reading the old data. Updated/added unit tests to test the old json layer vs. reading from the new SystemSerializer as well as just testing a new `System.Text.Json` complex scenario. Added tests for exceptions. TODO: - [ ] Add more tests? - [x] Run XAML Islands SystemInformation test - [ ] Do we want `SystemSerializer` to handle a few more 'basic' (but non-primitive) types? E.g. @Sergio0694 has a [similar implementation for a different related system](https://github.com/Sergio0694/Brainf_ckSharp/blob/master/src/Brainf_ckSharp.Services.Uwp/SettingsService.cs) - [ ] ???
Fixes #3636
Change implementation of JsonObjectSerializer to use DataContractJsonSerializer
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Microsoft.Toolkit.Uwp uses JsonSerializer
What is the new behavior?
Microsoft.Toolkit.Uwp uses DataContractJsonSerializer
PR Checklist
Please check if your PR fulfills the following requirements:
Other information