State Size on Windows Phone

2

I'm getting an error in my application that is really cryptic. My only thoughts are that I'm trying to save too much information into state. At the bottom of this post is the error message. I want to know if there is a good way to manage how much data you save to state. I am using a state manager right now to make saving the data quick but I obviously need to add some more logic to it that says, If Size > X, Save to Isolated instead of State.

What are the best practices around this?

Error: 0x80040204

   at Microsoft.Phone.Shell.Interop.ShellPageManager.SetProperty(String name, Byte[] blob)
   at Microsoft.Phone.Shell.StreamPersister.Save(ShellPageManager shellPageManager, String key, IDictionary`2 dictionary, IEnumerable`1 knownTypes)
   at Microsoft.Phone.Shell.PhoneApplicationService.FireDeactivated()
   at Microsoft.Phone.Execution.NativeEmInterop.FireOnPause()
c#
windows-phone-7
asked on Stack Overflow Apr 3, 2012 by firebellys • edited Apr 3, 2012 by firebellys

1 Answer

1

Look at the doc

You should not use this property for excessive storage because there is a limit of 2 MB for each page and 4 MB for the entire application.

First off, I would reconsider the design. How much do you save on average? What is the maximum? It's bad UX to let the user wait long time for loading. If you really need this consider using IsolatedStorageFile only without "if Size > X, Save to Isolated instead of State."

answered on Stack Overflow Apr 3, 2012 by Lukasz Madon

User contributions licensed under CC BY-SA 3.0