1

I am currently developing a Windows 8.1 Application using C# and XAML in which I store a huge amount of data using XML format in the local cache of the application. I am getting the following error with one of the XML files out of three since the other two are being created: "Error:There was an error generating the XML document." Below is my code:

 if (!string.IsNullOrEmpty(localData2))
            {
                StorageFile localFile = await ApplicationData.Current.LocalFolder
                    .CreateFileAsync("LocalCache2.xml", CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteTextAsync(localFile,
                    ObjectSerializer<ObservableCollection<aceapp.Competitor>>.ToXml(cacheXML2));
            }
            if (!string.IsNullOrEmpty(localData3))
            {
                StorageFile localFile = await ApplicationData.Current.LocalFolder
                    .CreateFileAsync("LocalCache3.xml", CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteTextAsync(localFile,
                    ObjectSerializer<ObservableCollection<aceapp.Attributes>>.ToXml(cacheXML3));
            }
            if (!string.IsNullOrEmpty(localData))
            {
                MemoryStream stream = new MemoryStream();
                StorageFile localFile = await ApplicationData.Current.LocalFolder
                    .CreateFileAsync("LocalCache1.xml", CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteTextAsync(localFile,
                    ObjectSerializer<ObservableCollection<aceapp.Sector>>.ToXml(cacheXML1));
            }

The Error is with the last XML which is the largest one. Any idea about this issue and how to fix it?

Sam
  • 355
  • 1
  • 4
  • 16
  • does your ram get filled up? Check in the task manager, you should use a difrent solution then if you are dealing with such huge amounts of data. Read it from the disk in batches or something along those lines – Vajura Oct 10 '14 at 10:50

0 Answers0