Another gotcha using DataContract and Isolated Storage

When my Silverlight application is initialized it loads settings from isolated storage. Everything seemed to be going well when it suddenly started to fail, odd. What is nice is the isolated storage file object has a path property so you can easily navigate through the bizarre set of folder locations and take a look at the actual file. The settings were saved by serializing an object via DataContract and thus ends up as XML. Opening the file I spotted that there was an extra ‘>’ at the end of the file. Suddenly I realised that the problem was the settings were overwriting the data in the file rather than overwriting the whole file. So my last set of settings was one character shorter than the previously persisted set. Changing the isolated file storage settings from OpenAndCreate to just Create solved the problem.

Advertisements
This entry was posted in Silverlight. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s