[Mono-bugs] [Bug 545588] New: ConfigurationManager.RefreshSection("appSettings") does not refresh the section.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 8 18:58:00 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=545588


           Summary: ConfigurationManager.RefreshSection("appSettings")
                    does not refresh the section.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Configuration
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: execrable at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3)
Gecko/20090924 Ubuntu/9.10 (karmic) Firefox/3.5.3

ConfigurationManager.RefreshSection("appSettings") is supposed to invalidate
the cache, so next time ConfigurationManager.AppSettings["key"] is accessed, it
reads it from the disk.

On Windows (.NET), this behaviour is correct, but on Linux (Mono), the values
are not updated until the application is re-launched.

There is some example code on the msdn site:
http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.refreshsection.aspx

which is pretty similar to what I am doing:

string url = ConfigurationManager.AppSettings["ServiceUrl"];
url = "something else";

Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

config.AppSettings.Settings.Remove("ServiceUrl");
config.AppSettings.Settings.Add("ServiceUrl", url);
config.Save(ConfigurationSaveMode.Modified);


ConfigurationManager.RefreshSection("appSettings");

foreach(string key in ConfigurationManager.AppSettings)
{
    string value = ConfigurationManager.AppSettings[key];
    Console.WriteLine("Key: {0}, Value: {1}", key, value);
}


Reproducible: Always

Steps to Reproduce:
1. Load ConfigurationManager.AppSettings
2. Open Configuration, Edit setting, Save Configuration.
3. ConfigurationManager.RefreshSection("appSettings")
4. Access ConfigurationManager.AppSettings
Actual Results:  
ConfigurationManager.AppSettings is not updated

Expected Results:  
ConfigurationManager.AppSettings should contain updated values.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list