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

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 5 05:22:32 EDT 2008


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

User kobruleht2 at hot.ee added comment
https://bugzilla.novell.com/show_bug.cgi?id=414445#c4


andrus moor <kobruleht2 at hot.ee> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
             Status|RESOLVED                                        |REOPENED
         Resolution|WORKSFORME                                      |




--- Comment #4 from andrus moor <kobruleht2 at hot.ee>  2008-08-05 03:22:31 MDT ---
I created new code to reproduce exception below.

Steps to reproduce exception using code below

1. Compile with Visual Studio or with mono 2.0 preview 1:

gmcs -pkg:dotnet -target:winexe test.cs

2. run using 

mono test.exe 2>t

Observed:

Unhandled Exception: System.TypeInitializationException: An exception was
thrown by the type initializer for 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 Settings..ctor () [0x00000] 

  at Settings..cctor () [0x00000] 

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

  at Program.Main () [0x00000] 


About previous code: I installed 2.0 preview 1 from binary distribution
package. Running code compiled with Visual Studio shows Arial font. I have
arial font installed.
So I expect running code from mono must show Arial font also.



New code to reproduce exception:

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

public sealed class FormData  
{
    public Point Location;
    public Size ClientSize;
    public FormWindowState WindowState;
    public int SplitterDistancePercent;
    string FormName;
    FormData() { }
}

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

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

    [global::System.Configuration.UserScopedSettingAttribute()]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Configuration.DefaultSettingValueAttribute(@"
          <FormData xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
            <Location>
              <X>10</X>
              <Y>20</Y>
            </Location>
            <ClientSize>
              <Width>1008</Width>
              <Height>703</Height>
            </ClientSize>
            <SplitterDistancePercent>0</SplitterDistancePercent>
        Arial, 12pt

        </FormData>
        ")]
    public FormData Mainform
    {
        get
        {
            return ((FormData)(this["Mainform"]));
        }
        set
        {
            this["Mainform"] = value;
        }
    }


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

class Program
{
    static void Main()
    {
        var res = Settings.Default.Mainform; //.font;
        MessageBox.Show(res.Location.ToString()); //.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