[Mono-list] TypeConverter cannot convert from System.String in 2.0 preview 1

Andrus kobruleht2 at hot.ee
Mon Aug 4 10:08:12 EDT 2008


My WinForms application does not start with 2.0 preview 1. Exception is
below.
Maybe this is because I store Font object in user settings:

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("Arial,
15pt")]
        public global::System.Drawing.Font TextBoxFont {
            get {
                return ((global::System.Drawing.Font)(this["TextBoxFont"]));
            }
            set {
                this["TextBoxFont"] = value;
            }
        }


How to fix ?

Andrus.

Unhandled Exception: System.TypeInitializationException: An exception was
thrown by the type initializer for
MyApplication.Windows.Forms.Properties.Settings --->
System.NotSupportedException: TypeConverter 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 MyApplication.Windows.Forms.Properties.Settings..ctor () [0x00000]
  at MyApplication.Windows.Forms.Properties.Settings..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at MyApplication.Windows.Forms.UserLoginForm.InitializeComponent ()
[0x00000]
  at MyApplication.Windows.Forms.UserLoginForm..ctor () [0x00000]
  at (wrapper remoting-invoke-with-check)
MyApplication.Windows.Forms.UserLoginForm:.ctor ()
  at MyApplication.Windows.Forms.AppMainEntry.Main () [0x00000]



More information about the Mono-list mailing list