« Return to Thread: ArrayConverter bug
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
« Return to Thread: ArrayConverter bug
| Free embeddable forum powered by Nabble | Forum Help |