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 Application.Properties implementation #4976

Merged
merged 2 commits into from
Mar 2, 2022
Merged

Conversation

eerhardt
Copy link
Member

The Application.Properties and SavePropertiesAsync APIs bring in a dependency
on DataContractSerializer in a default application. This, in turn, brings
in a lot of the System.Xml code by default.

Since these APIs are already marked as obsolete, and the recommendation is to use
the corresponding Essentials APIs, remove the implementation of these APIs and
instead throw an exception. This will allow for DataContractSerializer to be
removed in a default app.

From my local testing this removes 855 KB of IL in a dotnet new maui Android
application.

Before: 10.9 MB (11,431,696 bytes)
After: 10.0 MB (10,556,176 bytes)

And it cuts 1 MB out of a published dotnet new maui iOS application .ipa size.

Before: 18.0 MB (18,918,198 bytes)
After: 17.0 MB (17,850,723 bytes)

Fix #4864

The Application.Properties and SavePropertiesAsync APIs bring in a dependency
on `DataContractSerializer` in a default application. This, in turn, brings
in a lot of the System.Xml code by default.

Since these APIs are already marked as obsolete, and the recommendation is to use
the corresponding Essentials APIs, remove the implementation of these APIs and
instead throw an exception. This will allow for `DataContractSerializer` to be
removed in a default app.

From my local testing this removes 855 KB of IL in a `dotnet new maui` Android
application.

Before: 10.9 MB (11,431,696 bytes)
After: 10.0 MB (10,556,176 bytes)

And it cuts 1 MB out of a published `dotnet new maui` iOS application .ipa size.

Before: 18.0 MB (18,918,198 bytes)
After: 17.0 MB (17,850,723 bytes)

Fix dotnet#4864
@mattleibow
Copy link
Member

Probably old test code that needs deleting...

- Converted tests to Essentials.Preferences where applicable.
- Removed tests that were explicitly for testing Application.Properties.
@eerhardt
Copy link
Member Author

eerhardt commented Mar 1, 2022

@mattleibow @PureWeen - are you OK with the test changes I needed to make? If so, I believe this is ready now.

@eerhardt eerhardt merged commit eec992b into dotnet:main Mar 2, 2022
@eerhardt eerhardt deleted the Fix4864 branch March 2, 2022 05:34
@maonaoda
Copy link
Contributor

maonaoda commented Aug 8, 2023

How can i migrate the data saved in Application.Properties to Microsoft.Maui.Storage.Preferences Since Application.Properties Application.Properties was removed?

@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2!
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Proposal: Remove Application.Properties
4 participants