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

Sebastien Pouliot sebastien at ximian.com
Tue Feb 27 23:01:18 EST 2007


Hey,

Glad you found out the issue :-)

Are you getting the exact same error on the Mac, or just a similar one ?
A common mistake is that System.Drawing.dll can't load because X11
(and/or some other dependencies) can't be found.

Sebastien

On Tue, 2007-02-27 at 22:09 -0500, Fleury wrote:
> Eheh! The culprit on Linux has been found. Whilst playing around with
> the dependencies, I had left local copies on the Linux desktop (in the
> same place where I was executing the executables). It would appear as
> though it used the dlls that were on the desktop instead of the proper
> 2.0 dlls. So indeed, a configuration error as you predicted. :S
> 
> I deleted the dlls on the desktop, and now it is working. Hopefully it
> was just those dlls causing the problem, as I also disabled Input
> Method Editor and multi language support. 
> 
> My Mac environment does not have such an infestation of dlls on the
> desktop though, but I'll run through some of the directories to make
> sure.
> 
> .. I cannot believe I made such a noobish mistake, lol.... :( 
> 
> On 2/27/07, Fleury <fleurin at gmail.com> wrote:
>         The installation for Mono is pretty straight-forward. I'm
>         really not too sure how I could have done it wrong. And here
>         is 100% proof that they are all 2.0 references. Note the
>         different file name, as I'm currently trying out several
>         different ideas that are popping into my head (none of which
>         are working though). 
>         
>         thevenin at Frostwinds:~$ monodis --assemblyref 
>         
>         '/home/thevenin/Desktop/MClientXX.exe'
>         AssemblyRef Table
>         1: Version
>         
>         =2.0.0.0
>                 Name=mscorlib
>                 Flags
>         
>         =0x00000000
>                 Public Key:
>         0x00000000
>         
>         : B7 7A 5C 56 19 
>         
>         34 E0 89 
>         2: Version=
>         
>         2.0.0.0
>                 Name=System.Drawing
>                 Flags
>         
>         =0x00000000
>                 Public Key:
>         0x00000000
>         
>         : B0 3F 5F 7F 11 D5 
>         
>         0A 3A 
>         3: Version=
>         
>         2.0.0.0
>                 Name=System
>                 Flags=
>         
>         0x00000000
>                 Public Key:
>         0x00000000: B7 
>         
>         7A 5C 56 19 34 E0 
>         
>         89 
>         4: Version=2.0
>         
>         .0.0
>                 Name=System.Windows.Forms
>         
>                 Flags
>         =0x00000000
>                 Public Key:
>         0x00000000
>         
>         : B7 7A 5C 56 19 
>         
>         34 E0 89 
>         
>         ps.. this is my first time using a mailing list system. Thanks
>         for the 'cc' tip. ;)
>         
>         
>         
>         On 2/27/07, Sebastien Pouliot <sebastien at ximian.com> wrote:
>                 Hey,
>                 
>                 Well if it's not a reference mix up then you got a
>                 serious installation
>                 problem. Just to be 100% sure can you try
>                 
>                 monodis --assemblyref yourownproject.exe
>                 
>                 to see what everything that is referenced by your
>                 project. 
>                 
>                 Sebastien
>                 
>                 p.s. Please always c.c. the mailing-list in your
>                 answers. This way
>                 Google can (or will) answer to same question next
>                 time ;-)
>                 
>                 On Tue, 2007-02-27 at 21:06 -0500, Fleury wrote:
>                 > My project uses all 2.0 references. Inaddition, I
>                 just now tried
>                 > forcing the System.Windows.Forms to use the 1.x dll,
>                 but it seems to
>                 > default to 2.0 -- curious, no? Nevertheless, all my
>                 references are
>                 > from the GAC and are version 2.0.
>                 >
>                 > I wish it was as simple as just mixed up
>                 dependencies... ;)
>                 >
>                 > On 2/27/07, Sebastien Pouliot <sebastien at ximian.com>
>                 wrote:
>                 >         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/
>                 >
>                 >
>                 -- 
>                 Sebastien Pouliot  <sebastien at ximian.com>
>                 Blog: http://pages.infinit.net/ctech/
>                 
>         
>         
> 
> _______________________________________________
> 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