Feeds:
Posts
Comments

Posts Tagged ‘IsolatedStorageSettings’

This is a very simple case of saving a list of settings to Silverlight Isolated storage during an Application Exit event:

    IsolatedStorageSettings.ApplicationSettings[key] = settings;

When the application restarted, the ApplicationSettings were empty.     I did not received any errors until an explicit save was added:

    IsolatedStorageSettings.ApplicationSettings[key] = settings;
    IsolatedStorageSettings.ApplicationSettings.Save();

The save is normally not needed since the application settings are saved implicitly by the IsolatedStorageSettings class.  After the save was added, the following helpful exception was thrown:

The collection data contract type ‘System.Collections.Generic.List`1[[… ColumnSetting, … ‘ cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. …

Well, (duh) it turns out the problem had nothing to do with Isolated Storage.  Rather, it was the inadvertent omission of the public constructor that was causing the problem.

 

image

Read Full Post »