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


           Summary: Font cannot deserialized from string
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs@lists.ximian.com
        ReportedBy: [EMAIL PROTECTED]
         QAContact: mono-bugs@lists.ximian.com
          Found By: ---


To reproduce, run the code in Windows Vista.

Observed:

[Font: Name=Microsoft Sans Serif, Size=8, Units=2, GdiCharSet=1,
GdiVerticalFont=False]

Expected: 

[Font: Name=Arial, Size=10, Units=3, GdiCharSet=1, GdiVerticalFont=False]


Note:

In some cases, instead of messagebox, exception occurs:

 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 ApplicationSettingsBase.CreateSettingsProperty
 (System.Reflection.PropertyInfo prop,
 SettingsPropertyCollection properties,
 LocalFileSettingsProvider& local_provider) [0x00000]
  at ApplicationSettingsBase.get_Properties ()
 [0x00000]




using System.Windows.Forms;
using System.Configuration;
using System.Drawing;

class Settings : ApplicationSettingsBase
{
    private static Settings defaultInstance =
((Settings)(ApplicationSettingsBase.Synchronized(new Settings())));

    public static Settings Default
    {
        get
        {
            return defaultInstance;
        }
    }

    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("Arial, 10pt")]
    public Font font
    {
        get
        {
            return ((Font)(this["font"]));
        }
    }
}

class Program
{
    static void Main()
    {
        var res = Settings.Default.font;
        MessageBox.Show(res.ToString());
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  mono-bugs@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to