Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] Mono - Problems porting Windows Forms on Mac OS X

Started by Bearhugger Feb 26, 2009 at 4:13 PM 3 replies 3.6k views
Original Post
Bearhugger
Bearhugger
Hello. I have a problem. I made the game editor of my RPG in C# using Windows Forms. My friend, who would like to make levels, uses a Mac so I downloaded Mono on his MacBook. The migration toolkit told me that the project was fully compatible. Awesome! Oops... actually, it doesn't work that well. The forms are REALLY glitchy, the program won't load the assets, and the application freezes when I open a map. Is it that I'm doing something wrong? Or is it that the Windows Forms GUI package has not been fully implemented on Mono? Thanks in advance for any help or information.
vermilion_wizard
vermilion_wizard
Have you tried running it with Mono on Windows or Linux? WinForms in Mono is mostly complete, but there are still bugs around. Check to make sure you are not using backslashes "\" in paths when files are opened. The recommended approach is to use System.IO.Path.PathSeparator instead (although you can just use forward slash as a path separator, since that works on windows, linux and mac os). Make sure there are no absolute paths hardcoded into the app, especially ones which begin with a drive letter. Also, is the filesystem on the mac book case sensitive? The macs support both case sensitive and case insensitive file systems, and if it's case sensitive then you need to make sure any files that are opened match the case on the file system exactly.
Bearhugger
Bearhugger
First of all, thanks! It was a really good start. :)

I've replaced all backslashes path with the IO.Path.Combine function. It should be loading assets correctly now.

I have fixed the freeze, which was due to the toolbar component not working the same way in the Mono implementation.

There still seems to be a lot of problems of compatibility. The drag-and-drop feature of my event editor, which allows to move instructions or blocks of instructions within the script, does not work. It also sometimes crashes when I go in the menu bar. The Mono command prompt does not say anything when it crashes.

Then I have some GUI glitches as well. The event editor uses a hyperlink interface similar to the map editors of Starcraft and Warcraft III, but the links are always offset by one character. In addition, it is partly hidden in the margin.

Is there a way to configure Visual Studio to run Mono instead of the .NET runtime? I think I'll need a good debugger to make this program cross-platform. I know there is a decent Mono IDE for Linux, but my Linux partition is an outdated Mandrake 10.1 that's all screwed-up and I am more interested in deleting it than updating or installing a new Linux anyway.

I am running Mono on Windows. I have not tried the program on the MacBook right now.
vermilion_wizard
vermilion_wizard
Hmm I am not sure if drag and drop is supported on the Mac. I think it's not in GTK# but I don't know about winforms.

I think one way to get the debug information out of the mono command prompt is run it with something like "mono myprog.exe 2> debug.log". This will direct all stderr output to the file debug.log. Another way is add at startup "System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out))". This will add all debug messages to the console output (it will make them show up twice when running in VS).

I've seen some talk about Visual Studio integration with Mono on their website.
Search for Visual Studio on Mono's homepage.

The latest version of MonoDevelop has debugger integration. The last one I tried was 2.0 Alpha 2 which had the debugger working about half the time. I am installing OpenSuse right now in virtual box to try out the most recent MonoDevelop.

You might want to redirect some of you questions to the mono-winforms mailing list. The GUI glitches you are talking about are probably bugs that should be reported, if they aren't known about already.
Bearhugger
Bearhugger
Many of the bugs I am experiencing (or related bugs) are logged on the website so I suppose there isn't much I can do for that.

Many of them were flagged as Windows XP bugs so hopefully it will work better on the Mac.

Thanks for the hints and help. :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.