WindowSettings.SaveWindowState ConfigurationErrorsException #3131
Closed
Description
We have rare error logs from our users, that saving of the window state crashes the whole application.
ConfigurationErrorsException: Failed to save settings: It is an error to use a section registered as allowExeDefinition='MachineToRoamingUser' beyond the roaming user config, in the local user config.
...
at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
at System.Configuration.SettingsBase.SaveCore()
at System.Configuration.SettingsBase.Save() at System.Configuration.ApplicationSettingsBase.Save()
at MahApps.Metro.Controls.WindowSettings.SaveWindowState() at MahApps.Metro.
We do not have defined any MahApps
section in our App.config
. The section MahApps.Metro.Controls...
is added at runtime. It has allowExeDefinition="MachineToLocalUser"
on my computer and I guess on most other users has the same. I guess some users must have configured their system to use MachineToRoamingUser
by default. Or may it be caused by some changes in the system and upgrade of the settings?
Can you explicitly set AllowExeDefinition="MachineToLocalUser" in the code? Or may the Save()
method be enclosed in try catch?
Thanks
- MahApps.Metro 1.5.0
- .NET 4.5.2 or higher
- OS Vista or higher
I'm sorry do not know exact OS and .NET version.