[Mono-osx] winforms in mono on OSX 10.4.1

MrcLrssn at netscape.net MrcLrssn at netscape.net
Fri Jun 24 10:24:44 EDT 2005


I'm trying to use winforms in mono on OS X 10.4.1.

The following class:

using System;
using System.Windows.Forms;

public class MyForm : Form {

        public MyForm() {
              this.Text = "Hello Form";

        public static void Main() {
                Application.Run(new MyForm());

compiled with:

mcs /reference:System.dll /reference:System.Windows.Forms.dll HelloForms.cs

results in the following stack trace:

>mono HelloForms.exe
Mono System.Windows.Forms Assembly [Revision: 44786; built: 2005/5/25 22:34:45]
Keyboard: Latin American keyboard layout

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.NullReferenceException: Object reference not set to an instance of an object
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Drawing.GDIPlus:GdipGetGenericFontFamilySansSerif (intptr&)
in <0x00034> System.Drawing.FontFamily:get_GenericSansSerif ()
in <0x001fc> System.Windows.Forms.ThemeWin32Classic:.ctor ()
in <0x00098> System.Windows.Forms.ThemeEngine:.cctor ()--- End of inner exception stack trace ---

in <0x00000> <unknown method>
in <0x00014> System.Windows.Forms.Control:get_DefaultBackColor ()
in <0x00010> System.Windows.Forms.Control:get_DefaultBackColor ()
in <0x00088> System.Windows.Forms.Control:get_BackColor ()
in <0x00024> System.Windows.Forms.Form:get_BackColor ()
in <0x00190> System.Windows.Forms.Control:CreateHandle ()
in <0x00014> System.Windows.Forms.Form:CreateHandle ()
in <0x00040> System.Windows.Forms.Control:get_Handle ()
in (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:get_Handle ()
in <0x00050> System.Windows.Forms.Control:set_Text (System.String value)
in <0x00034> MyForm:.ctor ()
in (wrapper remoting-invoke-with-check) MyForm:.ctor ()
in <0x0002c> MyForm:Main ()

Any ideas,


Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp

More information about the Mono-osx mailing list