IsolatedStorageSettings.ApplicationSettings not saved for restart

I am writing a WP7 application (Mango). I store the values ​​in WP7 IsolatedStorageSettings.ApplicationSettings, then I call IsolatedStorageSettings.ApplicationSettings.Save();

If I go back and leave the screen and I go back, I can accurately estimate the values. However, if I press restart in the debugger (or just restart from the emulator), ApplicationSettings throws a KeyNotFoundException , as if it were not saved ...
I have not tried it on the device, now I do not have it.

What can i do wrong?

+4
source share
4 answers

It turns out that the problem is not in the AT ALL emulator , so everyone offering it “by design” in the emulator turned out to be erroneous (but I can’t cancel my upvotes as they are blocked).

The problem was that I was trying to save a non-serializable class, and wp7 handled this , dropping ALL of my settings to the next Save() . When I deleted this single Add () (or, rather, serialized this object from JSON.net (which MAY handle it) and saved the json string), all my problems just disappeared.

However, the ridiculous behavior on the wp7 part.

+7
source

This behavior is "by design" on the emulator.

I suggest below steps for your code. 1. The verification key is available or not 2. If not, set the default value for it.

+1
source

Check this question: Automatic login process in Windows Phone 7.1

  • In the emulator, IsolStorage is not maintained constant after a reboot, but for files and application settings -
  • You can use an isolated tool to store data from wp7 sdk to take a snapshot of the isolated contents of the storage and restore it after a reboot: Click
  • This issue does not occur on a real device where isolated storage constantly.
+1
source

I got the same error (the error occurs because after the debugger stops, the key is deleted ), and I asked the question: Automatically the process of entering the Windows Phone 7.1 application . suggest using site settings instead of application settings. Another option: http://www.codeguru.com/csharp/.net/wp7/article.php/c19215/Using-Isolated-Storage-for-your-Windows-Phone-7-WP7-App.htm . Hope it solves your problem.

0
source

Source: https://habr.com/ru/post/1396789/


All Articles