[Mono-winforms-list] How to setup Winforms support under Windows

Graeme Geldenhuys graeme at mastermaths.co.za
Tue Sep 20 06:00:45 EDT 2005

Hi Peter,

The application is basically a "Hello world" style app.  Just a single form and a single button. 
Nothing else.

Not sure what I did, but now I got a actual error saying that I am missing the gdiplus.dll file.

Is there supposed to be a gdiplus.dll file in the <mono install>\bin directory (windows version 
of mono).  By default there wasn't.  I then searched my harddrive and found one in the WinNT 
directory structure (C:\WINNT\Microsoft.NET\Framework\v1.1.4322\gdiplus.dll).  I copied it to the 
<mono install>\bin folder, and now my test app seem to work.

Doesn't the windows install of mono include the gdiplus.dll?  If not, then it means I need to 
install the Microsoft .NET framework and the Mono Framework under Windows, just to get the 
applications working...  This doesn't sound right?

The following example still doesn't work though....  Using the MS .NET framework it does, but not 
under Mono.  I don't think you can get a more basic application than this. :-)

---------------  CUT  ----------------------------
class HelloWindowsForms
    static void Main()
        System.Windows.Forms.MessageBox.Show("Welcome to the bill free zone.");
---------------  END  ----------------------------

Compiled with:
mcs HelloWinForms.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll /target:winexe

Executed as:
mono HelloWinForms.exe

Error received:
Unhandled Exception: System.TypeInitializationException: An exception was thrown
 by the type initializer for MessageBoxForm ---> System.Reflection.TargetInvocat
ionException: Exception has been thrown by the target of an invocation. ---> Sys
tem.NotImplementedException: Bitmap.InitFromStream (win32)
in <0x000fd> System.Drawing.Image:InitFromStream (System.IO.Stream stream)
in (wrapper remoting-invoke-with-check) System.Drawing.Image:InitFromStream (Sys
in <0x00104> System.Drawing.Bitmap:.ctor (System.Runtime.Serialization.Serializa
tionInfo info, StreamingContext context)
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (obj
in <0x0006f> System.Reflection.MonoCMethod:Invoke (System.Object obj, BindingFla
gs invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, Syst
em.Globalization.CultureInfo culture)--- End of inner exception stack trace ---

in <0x00104> System.Reflection.MonoCMethod:Invoke (System.Object obj, BindingFla
gs invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, Syst
em.Globalization.CultureInfo culture)
in <0x00017> System.Reflection.MethodBase:Invoke (System.Object obj, System.Obje
ct[] parameters)
in <0x0021d> System.Runtime.Serialization.ObjectRecord:LoadData (System.Runtime.
Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingConte
xt context)
in <0x00100> System.Runtime.Serialization.ObjectManager:DoFixups ()
in <0x0003f> System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadNex
tObject (System.IO.BinaryReader reader)
in <0x000b0> System.Runtime.Serialization.Formatters.Binary.ObjectReader:ReadObj
ectGraph (System.IO.BinaryReader reader, Boolean readHeaders, System.Object resu
lt, System.Runtime.Remoting.Messaging.Header[] headers)
in <0x00120> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Dese
rialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging
.HeaderHandler handler)
in <0x00012> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Dese
rialize (System.IO.Stream serializationStream)
in <0x0052b> System.Resources.ResourceReader:ResourceValue (Int32 index)
in <0x00023> System.Resources.ResourceReader+ResourceEnumerator:get_Value ()
in <0x00090> System.Resources.ResourceSet:ReadResources ()
in <0x00039> System.Resources.ResourceSet:GetObject (System.String name, Boolean
in <0x00081> System.Resources.ResourceManager:GetObject (System.String name, Sys
tem.Globalization.CultureInfo culture)
in <0x00010> System.Resources.ResourceManager:GetObject (System.String name)
in <0x00017> System.Windows.Forms.Locale:GetResource (System.String name)
in <0x00012> System.Windows.Forms.MessageBox+MessageBoxForm:.cctor ()--- End of
inner exception stack trace ---

in <0x00000> <unknown method>
in <0x0002c> System.Windows.Forms.MessageBox:Show (System.String text)
in <0x0000c> HelloWindowsForms:Main ()

  - Graeme -

On Mon, 19 Sep 2005 09:27:51 -0600, Peter Dennis Bartok wrote:

>No setup is required under Windows. A working Mono install should be enough. 
>Please provide the sample code that doesn't run, to allow some testing here.

More information about the Mono-winforms-list mailing list