Author: atsushi
Date: 2006-06-29 01:06:20 -0400 (Thu, 29 Jun 2006)
New Revision: 62136

Modified:
   trunk/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs
   trunk/mcs/class/System/System.Configuration/ChangeLog
   
trunk/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
   trunk/mcs/class/System/Test/System.Configuration/ChangeLog
Log:
2006-06-29  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * ApplicationSettingsBase.cs : When we use default value, convert it
          to proper type. Fixed bug #78654. Patch by Gareth Pearce.

        * ApplicationSettingsBaseTest.cs : added test for bug #78654.



Modified: trunk/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs
===================================================================
--- trunk/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs      
2006-06-28 23:00:20 UTC (rev 62135)
+++ trunk/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs      
2006-06-29 05:06:20 UTC (rev 62136)
@@ -263,6 +263,9 @@
                                                                }
                                                                else if (a is 
DefaultSettingValueAttribute) {
                                                                        
defaultValue = ((DefaultSettingValueAttribute)a).Value; /* XXX this is a 
string.. do we convert? */
+                                                                       if 
(prop.PropertyType != typeof(string)) {
+                                                                               
defaultValue = 
TypeDescriptor.GetConverter(prop.PropertyType).ConvertFromString((string)defaultValue);
+                                                                       }
                                                                }
                                                                else if (a is 
SettingsSerializeAsAttribute) {
                                                                        
serializeAs = ((SettingsSerializeAsAttribute)a).SerializeAs;

Modified: trunk/mcs/class/System/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Configuration/ChangeLog       2006-06-28 
23:00:20 UTC (rev 62135)
+++ trunk/mcs/class/System/System.Configuration/ChangeLog       2006-06-29 
05:06:20 UTC (rev 62136)
@@ -1,3 +1,8 @@
+2006-06-29  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * ApplicationSettingsBase.cs : When we use default value, convert it
+         to proper type. Fixed bug #78654. Patch by Gareth Pearce.
+
 2006-05-30  Gert Driesen  <[EMAIL PROTECTED]>
 
        * ConfigurationException.cs: BareMessage, Filename and Line properties

Modified: 
trunk/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
===================================================================
--- 
trunk/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs 
    2006-06-28 23:00:20 UTC (rev 62135)
+++ 
trunk/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs 
    2006-06-29 05:06:20 UTC (rev 62136)
@@ -311,6 +311,21 @@
                class Bug78430 : SettingsBase
                {
                }
+
+               [Test] // bug #78654
+               public void DefaultSettingValueAs ()
+               {
+                       Assert.AreEqual (1, new Bug78654 ().IntSetting);
+               }
+
+               class Bug78654 : ApplicationSettingsBase
+               {
+                       [UserScopedSettingAttribute ()]
+                       [DefaultSettingValueAttribute ("1")]
+                       public int IntSetting {
+                               get { return ((int)(this ["IntSetting"])); }
+                       }
+               }
        }
 
 }

Modified: trunk/mcs/class/System/Test/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Configuration/ChangeLog  2006-06-28 
23:00:20 UTC (rev 62135)
+++ trunk/mcs/class/System/Test/System.Configuration/ChangeLog  2006-06-29 
05:06:20 UTC (rev 62136)
@@ -1,3 +1,7 @@
+2006-06-29  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * ApplicationSettingsBaseTest.cs : added test for bug #78654.
+
 2006-05-17  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * LocalFileSettingsProviderTest.cs : commented some lines in

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to