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


source to share





All Articles