George
George

Reputation: 15561

C# Mono+Winforms MessageBox problem

I have a file called hellowf.cs

class MyFirstApp {
static void Main() {
     System.Windows.Forms.MessageBox.Show("Hello, Mono+WinForms!");
   }
}

On Ubuntu 8.10, I do the following

gmcs hellowf.cs -r:System.Drawing.dll -r:System.Windows.Forms.dll
mono hellowf.exe

... and it looks like this:

alt text http://img136.imageshack.us/img136/4674/helloproblemuk5.png


The second part of the message is missing. Why is this happening? The same binary - hellowf.exe - works fine on Windows.


Update: This is really annoying. Here are the mono versions I have had and tried to make this work on so far:

    1.9.1 (from official ubuntu repo)
    2.0.1 (from some some 3rd party repo)
    2.2   (wiped every mono pkg and compiled myself)

My Current mono version:

mono --version
Mono JIT compiler version 2.2 (tarball Wed Jan 14 22:58:21 CET 2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
gmcs --version
Mono C# compiler version 2.2.0.0

... any clues?

Upvotes: 5

Views: 4855

Answers (5)

jpobst
jpobst

Reputation: 9982

When you updated your packages and source code, did you update/compile libgdiplus? We have seen some funky graphical problems if the System.Drawing and libgdiplus versions get out of sync.

Upvotes: 0

George
George

Reputation: 15561

Finally I have found a workaround. This seems to be a bug in Mono related to font rendering. It happens when "Full" hinting is turned on. I usually have it that way. Changing it to "Slight" or "Medium" in System->Preferences->Appearance->Fonts->Details fixes the problem. Thanks for the help!

Upvotes: 3

abelenky
abelenky

Reputation: 64710

Standard debugging advice: Start making small, controlled changes, and see what happens. This will help narrow down what the problem is.

Try removing the symbols: , + !
Try removing the space.
Try a variety of shorter strings, and possibly some longer strings.

Once you have a better idea of what the MessageBox will and will not print, you can start to debug that specific problem, instead of trying to debug, "It doesn't work!"

Upvotes: 0

Sunny Milenov
Sunny Milenov

Reputation: 22310

Works OK on opensuse 11.0, mono 2.0.1.

Please, edit your question and put the mono version you are using.

Upvotes: 1

Tom Anderson
Tom Anderson

Reputation: 10827

stick an @ in front of the "Hello, Mono+WinForms!" and see if it still happens.

Upvotes: 0

Related Questions