[Mono-bugs] [Bug 468658] New: System.Configuration: Application Scope settings are saved in user.config

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 22 17:41:30 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=468658


           Summary: System.Configuration: Application Scope settings are
                    saved in user.config
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: thom at union.waw.pl
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=267051)
 --> (https://bugzilla.novell.com/attachment.cgi?id=267051)
Source code to reproduce problem.

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; pl;
rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5

When using System.Configuration.ApplicationSettingsBase.Save() it should save
ONLY User Scope settings (only keys that are in userSettings). Unfortunately,
it saves also Application Scope settings in userSettings section which raises
key duplication exception.
Microsoft .Net stores in user.config only user scope settings.


Reproducible: Always

Steps to Reproduce:
1. Compile sources.
2. Run them - it should work without problems (you need to press any key to
continue program execution).
3. Run it again and there will be a exception.
Actual Results:  
Unhandled Exception: System.Configuration.ConfigurationErrorsException: Failed
to load value for 'AppSetting2'. ---> System.ArgumentException: Key duplication
when adding: AppSetting2
  at System.Collections.Hashtable.PutImpl (System.Object key, System.Object
value, Boolean overwrite) [0x00000] 
  at System.Collections.Hashtable.Add (System.Object key, System.Object value)
[0x00000] 
  at System.Configuration.SettingsPropertyValueCollection.Add
(System.Configuration.SettingsPropertyValue property) [0x00000] 
  at System.Configuration.CustomizableFileSettingsProvider.LoadPropertyValue
(System.Configuration.SettingsPropertyCollection collection,
System.Configuration.SettingElement element, Boolean allowOverwrite) [0x00000] 
  --- End of inner exception stack trace ---
  at System.Configuration.CustomizableFileSettingsProvider.LoadPropertyValue
(System.Configuration.SettingsPropertyCollection collection,
System.Configuration.SettingElement element, Boolean allowOverwrite) [0x00000] 
  at System.Configuration.CustomizableFileSettingsProvider.LoadProperties
(System.Configuration.ExeConfigurationFileMap exeMap,
System.Configuration.SettingsPropertyCollection collection,
ConfigurationUserLevel level, System.String sectionGroupName, Boolean
allowOverwrite, System.String groupName) [0x00000] 
  at System.Configuration.CustomizableFileSettingsProvider.GetPropertyValues
(System.Configuration.SettingsContext context,
System.Configuration.SettingsPropertyCollection collection) [0x00000] 
  at System.Configuration.LocalFileSettingsProvider.GetPropertyValues
(System.Configuration.SettingsContext context,
System.Configuration.SettingsPropertyCollection properties) [0x00000] 
  at System.Configuration.ApplicationSettingsBase.CacheValuesByProvider
(System.Configuration.SettingsProvider provider) [0x00000] 
  at System.Configuration.ApplicationSettingsBase.GetPropertyValue
(System.String propertyName) [0x00000] 
  at System.Configuration.ApplicationSettingsBase.get_Item (System.String
propertyName) [0x00000] 
  at ConfigTest.Properties.Settings.get_UserSetting1 () [0x00000] 
  at ConfigTest.Program.Main (System.String[] args) [0x00000] 


Expected Results:  
Application Scope settings should not be saved in user.config file. Program
should run properly.

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


More information about the mono-bugs mailing list