ArgumentNullException when calling Upgrade () in app settings

I have a windows service that takes user realm settings and loads them at service startup using the following code:

Properties.Settings.Default.Reload();
if (Properties.Settings.Default.UpgradeRequired)
{
  Properties.Settings.Default.Upgrade();
  Properties.Settings.Default.UpgradeRequired = false;
}

      

On one production machine, the service fails to start and I get ArgumentNullException

from the method Reload()

with the following stack trace:

System.ArgumentNullException: Value cannot be null.
Parameter name: path
  at System.IO.Directory.GetParent(String path)
  at System.Configuration.LocalFileSettingsProvider.GetPreviousConfigFileName(Boolean isRoaming)
  at System.Configuration.LocalFileSettingsProvider.Upgrade(SettingsContext context, SettingsPropertyCollection properties, Boolean isRoaming)
  at System.Configuration.LocalFileSettingsProvider.Upgrade(SettingsContext context, SettingsPropertyCollection properties)
  at System.Configuration.ApplicationSettingsBase.Upgrade()

      

It is not documented what a method Upgrade()

can throw ArgumentNullException

. Does anyone have an idea what this might mean and / or how I can solve this without restoring the service?

+3
c # .net-3.5 application-settings


source to share


No one has answered this question yet

Check out similar questions:

1242
When to use struct?
1174
Virtual invocation of the participant in the constructor
1169
Calling the basic constructor in C #
540
How do I save application settings in a Windows Forms application?
310
Error message "Unable to load one or more of the requested types. Get the LoaderExceptions property for more information. '
264
The timeout has expired. The timeout period expires before the operation completes or the server is not responding. Application has been terminated
3
Value cannot be empty - Application Manager
3
ArgumentNullException while uninstalling the application
1
How IList.Distinct method throws ArgumentNullException in a given scenario
0
Folder.Bind Throws ArgumentNullException



All Articles
Loading...
X
Show
Funny
Dev
Pics