I have a C# Winforms application that uses app.config to save 3 simple settings.
string
bool
bool
This is a multi-instance application and when a user has more then one instance open and closes the application group, they are met with
System.Configuration.ConfigurationErrorsException: Failed to save settings: The configuration file has been changed by another program.
What is the best way to manage this?
I know I can catch the error and return out of application-exit method but this seems improper. It would seem to me that there should be a way to check if another instance is working in the file before calling Properties.Settings.Default.Save();
and then return out of the method.
Catch the exception and call Properties.Settings.Default.Reload()
then attempt to save again.