Configuration file changed by another program.


First of all thanks for your great work! I really like SettingsManager alot.
But theres a little problem. Simply change your Example programm, so that both FormMain and SubForm will use the 'SettingsForm' as base. This will cause an error in in Gl.SettingsManager.Providers.ConfigurationFileSettingsProvider.Save() when both forms try to save their configuration settings.
Text **************
System.Configuration.ConfigurationErrorsException: The configuration file has been changed by another program. (C:\Users[User]\AppData\Local\SettingsManagerTest\SettingsManagerTest.exe_Url_0jyusyijq2ayhpe5gyt15g0mvkwxldhs\\user.config)
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSaveAll)
at System.Configuration.Configuration.Save(ConfigurationSaveMode saveMode, Boolean forceSaveAll)
at Gl.SettingsManager.Providers.ConfigurationFileSettingsProvider.Gl.SettingsManager.ISettingsProvider.Save() in F:\SettingsManager\SettingsManager\Providers\ConfigurationFileSettingsProvider.cs:line 46
at Gl.SettingsManager.Settings.InternalSave(Object obj, Boolean validate) in F:\SettingsManager\SettingsManager\Settings.cs:line 141
at Gl.SettingsManager.Settings.Save(Object obj) in F:\SettingsManager\SettingsManager\Settings.cs:line 117
at Gl.SettingsManager.SettingsForm.OnClosing(CancelEventArgs e) in F:\SettingsManager\SettingsManager\SettingsForm.cs:line 51
at System.Windows.Forms.Form.WmClose(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
Assembly Version:
Win32 Version: 2.0.50727.1434 (REDBITS.050727-1400)


Excel wrote May 1, 2008 at 2:15 PM

Simply solve the problem by using Singleton-Pattern in CreateConfigurationFileSettingsProvider() method of Settings class. You cannot have more than once instance of settings manager writing into the settings file. Always using the same instance of the ConfigurationFileSettingsProvider will solve the problem (hopfully without any side effects).

MyP3uK wrote Jul 10, 2008 at 9:37 PM

Sorry for my very late response.
I had to abandon this project for a little while. Lots of job.
It seems to me that this problem can be solved internally in SettingsManager. I'll try to fix it today.

wrote Feb 12, 2013 at 11:47 PM