Reputation: 9870
I have a windows 8.1 app that is using this code to load the previous state of the app:
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
if (roamingSettings.Values.ContainsKey("userName"))
{
nameInput.Text = roamingSettings.Values["userName"].ToString();
}
The roamingSettings are stored here:
C:\Users\username\AppData\Local\Packages\87bfb6d3-2d15-43bb-8f52-7ee30bdd4c4e_c7a7mhx3d14pp\Settings\settings.dat
I ran regedit.exe as admin and opened the settings.dat file and changed the "userName" value, however when I ran the app again, I got this exception:
An exception of type 'System.Exception' occurred in HelloWorld.exe but was not handled in user code
WinRT information: Error trying to initialize the application data container server
Additional information: Loading the state store failed.
Why won't it let me change the userName directly from the settings.dat file?
Upvotes: 0
Views: 611
Reputation: 1967
Might be a bit late, but you have to unload the file after editing, otherwise it will be locked by the registry editor: Select the loaded key, then go to the menu: File -> Unload Hive
Upvotes: 0
Reputation: 9870
Not sure what the underlying reason is, but if I reset my laptop and run the app again, the app runs and shows the edited value I put in the .dat file.
Upvotes: 0