[Mono-bugs] [Bug 414445] New: Font cannot deserialized from string

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 4 14:14:35 EDT 2008


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 at lists.ximian.com
        ReportedBy: kobruleht2 at hot.ee
         QAContact: mono-bugs at 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.


More information about the mono-bugs mailing list