[Mono-list] REQUEST

A Rafael D Teixeira rafael.teixeirabr@terra.com.br
Mon, 07 Jun 2004 11:48:05 -0300


On Wed, 2004-06-02 at 14:42, Alessandro wrote:
> I'm trying to start a simple windows .net form compiled with C# and also with mcs.exe
> the result i the same:
> On windows platform with .net framework all works fine and I see my form (a simple form without
> controls)
> Wine is the last ver and works fine, I 've installed all cairo etc.... and winelib
> N.B: Console applications on mono work fine

First, Win Forms are just a preview currently in Mono, because they
aren't complete and rock-stable. But let's look at your problem.

> 
> On mono this is the result :
> 
> bash-2.05b# mono -v Form1.exe 
> Method (wrapper runtime-invoke) System.OutOfMemoryException:.ctor (object,intptr
> ,intptr) emitted at 0x40928000 to 0x4092809a [Form1.exe]
...
> Method (wrapper runtime-invoke) System.StackOverflowException:.ctor (object,intp
> tr,intptr) emitted at 0x40928258 to 0x409282f2 [Form1.exe]
...
> Method (wrapper runtime-invoke) WindowsApplication2.Form1:Main (object,intptr,in
> tptr) emitted at 0x40928460 to 0x409284e0 [Form1.exe]
...
> Method WindowsApplication2.Form1:Main () emitted at 0x409284e8 to 0x40928516 [Fo
> rm1.exe]
...

Well looks like you are consuming all your memory/stack-space, because
you are calling Main recursively in the Form constructor.

DON'T DO THAT!!! Main is automatically called by the runtime, and it
normally calls the constructor for the main form, not the reverse. You
are just making it into infinite recursion... What truly can't be
infinite because at some point you consume too much resources (memory in
your case) and the program aborts.

Also it helps to read your code and the stack trace, to find what and
where the error is so probably you could figure out yourself what was
wrong.

Hope it helps,
-- 
Rafael "Monoman" Teixeira 
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
Mono Brasil Founding Member - http://monobrasil.redesolbrasil.org/
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/