[Mono-winforms-list] System.MissingMethodException -- get_DefaultFont!

Sebastien Pouliot sebastien at ximian.com
Tue Feb 27 21:05:55 EST 2007


Hello,

System.Drawing.SystemFonts.DefaultFont exists since 2005 (but it's a 2.0
class). 

I got the feeling you added a reference to 2.0 System.Windows.Forms.dll
(from the GAC path you provided) from a 1.x project (since you said you
*tried* to target 2.0) - which is *bad*.

Either use 1.1 or 2.0 for your projects but don't mix them (and live an
happy life ;-)

Sebastien

On Tue, 2007-02-27 at 20:39 -0500, Fleury wrote:
> When trying to run even the most basic Windows Forms app on Linux or
> Mac (note: Windows works) I get this error message...
> 
> ---------------------------------------------
> 
> thevenin at Frostwinds:~$ mono '/home/thevenin/Desktop/testme.exe' 
> 
> ** (/home/thevenin/Desktop/testme.exe:5767): WARNING **: Missing
> method get_DefaultFont in
> assembly /home/thevenin/mono-1.2.3.1/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll, type System.Drawing.SystemFonts
> Gtk colorscheme read failure, using built-in colorscheme
> 
> Unhandled Exception: System.TypeInitializationException : An exception
> was thrown by the type initializer for
> System.Windows.Forms.ThemeEngine ---> System.MissingMethodException:
> Method not found: 'System.Drawing.SystemFonts.get_DefaultFont'.
>   at <0x00000> <unknown method> 
>   at System.Windows.Forms.ThemeWin32Classic..ctor () [0x00000] 
>   at System.Windows.Forms.ThemeEngine..cctor () [0x00000] --- End of
> inner exception stack trace ---
> 
>   at <0x00000> <unknown method> 
>   at System.Windows.Forms.X11DesktopColors..cctor () [0x00000] 
> 
> -----------------------------------------------------------
> 
> As you can see, I'm using mono-1.2.3.1, and of course reference
> System.Windows.Forms from the GAC. I have tried setting Sharp Develop
> to target platform Mono 2.0 and even NET 2.0, yet neither resolve
> this. Any ideas?
> 
> I'm running the latest version of Ubuntu btw.
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/



More information about the Mono-winforms-list mailing list