[Mono-devel-list] Winelib problem?

Paul Johnson paul at all-the-johnsons.co.uk
Mon Jun 7 05:42:10 EDT 2004


Hi,

I'm using the FC2 version of Mono with the following source

using System;
using System.Windows.Forms;

namespace ProgCSharp
{
  public class HandDrawnClass : Form
  {
    private System.Windows.Forms.Label lblOutput;
    private System.Windows.Forms.Button btnCancel;

    public HandDrawnClass()
    {
      this.lblOutput = new System.Windows.Forms.Label();
      this.btnCancel = new System.Windows.Forms.Button();
      this.Text = "Hello World";
      lblOutput.Location = new System.Drawing.Point(16, 24);
      lblOutput.Text = "Hello World";
      lblOutput.Size = new System.Drawing.Size(216, 24);

      btnCancel.Location = new System.Drawing.Point(150, 200);
      btnCancel.Size = new System.Drawing.Size(112, 32);
      btnCancel.Text = "&Cancel";

      btnCancel.Click += new System.EventHandler(this.btnCancel_Click);

      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(300, 300);
      this.Controls.Add (this.btnCancel);
      this.Controls.Add (this.lblOutput);
    }

    protected void btnCancel_Click(object sender, System.EventArgs e)
    {
      Application.Exit();
    }

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

This compiles cleanly. However, when I attempt to run the program, a
couple of windows appear very briefly and I then get this from the
console


Unhandled Exception: System.NullReferenceException: A null value was
found where an object instance was required.
in (unmanaged) (wrapper managed-to-native)
System.Windows.Forms.Win32:DispatchMessageA (System.Windows.Forms.MSG&)
in <0x00004> (wrapper managed-to-native)
System.Windows.Forms.Win32:DispatchMessageA (System.Windows.Forms.MSG&)
in <0x00128> System.Windows.Forms.Application:enterModalLoop
(System.Windows.Forms.Form)
in <0x000b4> System.Windows.Forms.Form:ShowDialog ()
in <0x00050> (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:ShowDialog ()
in <0x00562> System.Windows.Forms.Application:OnThreadException
(System.Exception)
in <0x0000a> System.Windows.Forms.NativeWindow:OnThreadException
(System.Exception)
in <0x001e3> System.Windows.Forms.NativeWindow:WndProc
(intptr,System.Windows.Forms.Msg,intptr,intptr)
in <0x00088> (wrapper native-to-managed)
System.Windows.Forms.NativeWindow:WndProc
(intptr,System.Windows.Forms.Msg,intptr,intptr)
in (unmanaged) (wrapper managed-to-native)
System.Windows.Forms.Win32:DispatchMessageA (System.Windows.Forms.MSG&)
in <0x00004> (wrapper managed-to-native)
System.Windows.Forms.Win32:DispatchMessageA (System.Windows.Forms.MSG&)
in <0x0025b> System.Windows.Forms.Application:Run ()
in <0x00087> System.Windows.Forms.Application:Run
(System.Windows.Forms.ApplicationContext)
in <0x00040> System.Windows.Forms.Application:Run
(System.Windows.Forms.Form)
in <0x00024> ProgCSharp.HandDrawnClass:Main ()

The first line is the most interesting (Unhandled Exception:
System.NullReferenceException: A null value was found where an object
instance was required) as for quite a bit of the time, this is the first
line reported when applications crash out on me.

Any ideas why this should be happening?

The only thing I can put it down to is either gtk-sharp being silly (I
had to compile it from source as the rpm wanted gtkhtml3.0.10 and I'm
running 3.0.14 (IIRC)) or wine being odd. I say wine being odd as when I
do a wine -v, it says it's 20040408 yet rpm -q wine shows the versions
shipped with Mono beta 2. which wine gives /usr/bin/wine - there are no
other self compiled versions of wine on the system.

TTFN

Paul
-- 
"There are four stages to any war
First they ignore you, then they laugh at you
Then they fight you, then YOU win"
Ghandi




More information about the Mono-devel-list mailing list