Hi,
I’m having a problem loading data on a Windows Store app. Here’s a snippet of my code to load:
if (container.FileExists(ProgressFileName))
{
try
{
Stream stream = container.OpenFile(ProgressFileName, FileMode.Open, FileAccess.Read);
This throws the following exception:
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
The code to write to the file is as follows (and executes without any exceptions):
StorageContainer container = mDevice.EndOpenContainer(result);
if (container != null)
{
if (container.FileExists(ProgressFileName))
{
container.DeleteFile(ProgressFileName);
//TODO Backup previous file and put it back in case of error saving
}
Stream stream = container.CreateFile(ProgressFileName);
XmlSerializer serializer = new XmlSerializer(typeof(SaveGameData));
serializer.Serialize(stream, SavedProgress);
stream.Flush();
stream.Dispose();
container.Dispose();
}
Am I missing something?
Thank you.