Short version: How would you store "large" data in a Windows Store app, using C#?
Long version: I have a json string that I could either store as string (around 65 KB) or - when serialized - as object. I originally thought that I could use something like this:
public static void SaveData(string param, object value)
{
Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();
composite[param] = value;
settings.Values[param] = composite;
}
I tried that, but my app shows the following error:
WinRT information: Error trying to write setting in application data composite value
The error is not really helping me, it simply does not want to save my data. I have just read online that there is only a ridiculous small amount of Bytes allowed to store in the local settings in a Windows Store app using C#.
Is there a fast, safe and elegant way to store my string/object otherwise? Do I really need to write it into a file by myself? Using SQLLite would also be way too much for just this string.
Microsoft uses a hidden folder named WindowsApps to install these Metro/Modern apps. The folder is located within the Program Files folder in the system drive (C:\). Data for all of the Modern Apps are stored in the AppData folder under the user's profile.
The Microsoft Store – formerly called the Windows Store -- is an online marketplace for consumers to buy and download a variety of items. The store enables users to purchase hardware such as PCs, Surface products and Xbox consoles, or download software and digital content, including apps, games, movies or TV shows.
Microsoft Store has nearly everything you could want for your Windows device, including the latest games, popular movies and TV shows, creativity software, apps,1 and more.
The data you are trying to store in local settings container exceeds the limits. Quoting from here: ApplicationData.LocalSettings | localSettings property
The name of each setting can be 255 characters in length at most. Each setting can be up to 8K bytes in size and each composite setting can be up to 64K bytes in size.
You can use ApplicationData.LocalFolder | localFolder instead to store the data. There is sample code is in that link too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With