[Mono-list] ArrayConverter bug

Iggy MA iggy.ma at gmail.com
Fri Jul 11 15:23:41 EDT 2008


Why do you have an quote here </ArrayOfInt>")] , could that be causing the
problem?


http://iggyma.blogspot.com/




pgutierrez wrote:
> 
> A Settings class with the following property fails to initialize:
> 
> [global::System.Configuration.ApplicationScopedSettingAttribute()]
> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
> [global::System.Configuration.DefaultSettingValueAttribute(@"<?xml
> version=""1.0"" encoding=""utf-16""?>
> <ArrayOfInt xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
> xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
>   <int>3001</int>
>   <int>3002</int>
>   <int>3003</int>
>   <int>3004</int>
>   <int>3005</int>
>   <int>3006</int>
>   <int>3007</int>
>   <int>3008</int>
>   <int>3009</int>
>   <int>3010</int>
> </ArrayOfInt>")]
>         public int[] RemotingPorts {
>             get {
>                 return ((int[])(this["RemotingPorts"]));
>             }
>         }
> 
> When the program tries to access this property a exception is thrown:
> 
> Unhandled Exception: System.TypeInitializationException: An exception was
> thrown by the type initializer for Kern.Properties.Settings --->
> System.NotSupportedException: ArrayConverter cannot convert from
> System.String.
>   at System.ComponentModel.TypeConverter.GetConvertFromException
> (System.Object value) [0x00000] 
>   at System.ComponentModel.TypeConverter.ConvertFrom
> (ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
> System.Object value) [0x00000] 
>   at System.ComponentModel.TypeConverter.ConvertFrom (System.Object o)
> [0x00000] 
>   at System.ComponentModel.TypeConverter.ConvertFromString (System.String
> text) [0x00000] 
>   at System.Configuration.ApplicationSettingsBase.CreateSettingsProperty
> (System.Reflection.PropertyInfo prop,
> System.Configuration.SettingsPropertyCollection properties,
> System.Configuration.LocalFileSettingsProvider& local_provider) [0x00000] 
>   at System.Configuration.ApplicationSettingsBase.get_Properties ()
> [0x00000] 
>   at System.Configuration.ApplicationSettingsBase..ctor () [0x00000] 
>   at Kern.Properties.Settings..ctor () [0x00000] 
>   at Kern.Properties.Settings..cctor () [0x00000] --- End of inner
> exception stack trace ---
> 
> This happens with mono 1.9.1 under Ubuntu and Mac OS X.
> 
> Regards,
> 
> Pedro
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ArrayConverter-bug-tp18290337p18410901.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list