WinRT app change appmanifest destroys application data

In my WinRT application, I store user data (not session data) in a local file. The file is saved and uploaded through ApplicationData.Current.LocalFolder.

Each time I make small changes to the manifest application, these saved files and application settings will be invalid and deleted when the application starts. Is it only in the development environment, one way or another also happens when the package was published in the application store?

How can I prevent the system from working? The user will be very unhappy if he loses his data due to a version change!

Update 1:
Thanks to Hans Passant, I found out that the data files have a version . Installing a data file version fixed the issue for version changes (increment only), but not for other manifest changes.

Update 2:
In the meantime, I also noticed that not only changes in the properties of the application manifest have this effect. If I add a new resource file for a new language (localization), the data will also be deleted. It would be very nice to know if this strange behavior will also exist in installed applications published through the store.

+7
source share
2 answers

The answer to my question seems not so easy. In the end, I noticed that it probably consists of two different problems. I found only very little information on the Internet , so everything I write here is a little speculative, based on some simple tests that I did.

Version Changes
Thanks to Hans Passant, I found out that data files can have version . Due to the lack of documentation, I am installing the version and version of the version as follows:

await ApplicationData.Current.SetVersionAsync((uint)1, (setVersionRequest) => { }); 

Code is executed at any time before loading data files. Since I have no changes in my file format, I leave the change callback empty {} .
After pasting the above code, the version changes no longer deleted my application data when changing version properties. However, as a test, I subsequently deleted the code and unexpectedly, any changes in the version no longer deleted the application data files! Maybe because they are now being versioned. (As a sideline: reducing version results always leads to the loss of data files).

General manifest changes
The effect that changing the properties of the manifest (except the Version properties) deletes the data has not disappeared . If you change, for example, the description of the application, all data will be deleted. I found several messages suggesting that this would not happen in the store, but I did not find any evidence.

Adding Languages
Another effect that I observed is that if I add a new language to the application (by adding a ressource file), it will do the same.

Please note: all of the above explanations are based on observations from my development environment. I did not find any specific documentation, and therefore I recommend that everyone carefully check the appropriate use cases so as not to make your customers very unhappy. Probably in a few months more specific documentation will appear.

+2
source

This should only happen in the dev environment. After the application is published, the manifest is fixed and will not change *.

* Except for the following circumstances: 1) you change it and reload it, and 2) the manifest is more than likely to change the certification process, and this can be expected.

0
source

All Articles