I have a PeriodicTask that updates a tile for my phone app and saves the information to persisted storage.
This works fine until the list gets to around a size of 11 or 12.
The objects that I save is a poco object with about 5 members. I basiclly get data, save data and create tile (not shown).
so
//get data
var newData = GetPocoFromWeb();
base.Add(newData);
the base class
public abstract class DataFetcher<T> where T : IDataCarrier, new()
{
protected readonly IPersist<List<T>> Persist;
protected DataFetcher(IPersist<List<T>> persist)
{
Persist = persist;
}
protected void Add(T item)
{
var items = Persist.Load();
items.Add(item);
Persist.Save(items);
}
}
The persist class
public class Persist<T> : IPersist<T>
{
private readonly string _identifier;
public Persist(string identifier)
{
_identifier = identifier;
}
public virtual T Load()
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(_identifier))
{
return (T)IsolatedStorageSettings.ApplicationSettings[_identifier];
}
return default(T);
}
public virtual void Save(T item)
{
IsolatedStorageSettings.ApplicationSettings[_identifier] = item;
IsolatedStorageSettings.ApplicationSettings.Save();
}
}
Am I perhaps using wrong storage? 11 items in a list isn't really that many.
Update: When I load the list and add to it using the application (not through the periodicTask) i can easily save several hundred items.
I don't get any error when running in emulator, it just works till the list has around 11 items and then stops working.