I have an issue when reading from an xml file with the object Friend in it!
file.exist() returns true but when he opens storage, an exception is thrown!
public static async Task<List<Friend>> Load<Friend>(string file)
{
IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
List<Friend> friend = Activator.CreateInstance<List<Friend>>();
if (storage.FileExists(file))
{
IsolatedStorageFileStream stream = null;
try
{
stream = storage.OpenFile(file, FileMode.Open);
XmlSerializer serializer = new XmlSerializer(typeof(List<Friend>));
friend = (List<Friend>)serializer.Deserialize(stream);
}
catch (Exception)
{
}
finally
{
if (stream != null)
{
stream.Close();
stream.Dispose();
}
}
return friend;
}
return friend;
}