Trying MonoDevelop On OS X, Part Two
Posted by Davy Brion on December 19th, 2009
I played around with MonoDevelop 2.2 beta 1 on OS X a while ago. Back then i considered it promising, yet unusable due to the fact that writing and editing code was extremely slow. The Mono project recently released Mono 2.6 and a final MonoDevelop 2.2 release so i figured i’d give it another shot on OS X.
Installation was yet again a breeze… you’re basically up and running within 5 minutes (depending on the speed of your internet connection for downloading the bits obviously). And this time, the code writing/editing problems have been solved and you can indeed write code in it. Instead of trying some silly example in it, i wanted to see if Agatha’s in-process Hello World example would work on Mono. I downloaded the code, and opened the Examples solution:
This solution contains 2 Silverlight projects, 2 Web Application Projects, some regular .NET class libraries and 2 console projects. MonoDevelop opened it all without any problems and seemed to recognize the different kinds of projects without problems:
While it may not seem impressive to you, i was glad to see that it correctly determined that the Agatha.Common.Silverlight project is indeed a Silverlight project instead of a regular .NET project. Because the Agatha.Common.Silverlight needs to have some types that are also present in the Agatha.Common assembly, i used linked files in the Agatha.Common.Silverlight project to include those types in the Silverlight assembly. MonoDevelop nicely picked up on that, and even seems to play more nicely with linked files than Visual Studio does:
After that i wanted to change the code formatting options to the settings that i prefer. In the beta 1 version that i tried earlier, there were plenty of formatting options that you could change, but unfortunately it appears that they cut it from the final release:
This is very unfortunate because the number of settings that you can change for C# formatting is, as you can see, extremely limited.
Oh well, i was curious to see whether Agatha’s in-process Hello World example would work so i just started the Sample.ServiceAndClientInSameProcess console project. Now, keep in mind that this in-process sample doesn’t use Silverlight, nor WCF, nor ASP.NET… it’s just a simple .NET process. Unfortunately, it crashed:
Now, before people blame the Castle.MicroKernel code for this problem it’s important to remember that this code works without problems on Windows with Microsoft’s .NET runtime. And that is basically the problem i’ve had with Mono every time i tried it for more than something trivial. Code that works on Microsoft’s .NET runtime should behave exactly the same on Mono if they ever want to be a viable cross-platform .NET implementation. Hell, even bugs in Microsoft’s .NET runtime should be duplicated, so i don’t care if there’s a bug in either Mono’s or Microsoft’s implementation of the ReaderWriterLock class. Both implementations should behave the same and that’s all there is to it.
I still wanted to see it working on Mono, so i went to the part of the code that configures Agatha to use Windsor:
This isn’t the default color scheme that MonoDevelop uses, but it is one of the default schemes that ships with the IDE which is certainly a nice touch.
I just needed to change the last argument to the ServiceLayerAndClientConfiguration constructor to a new instance of Agatha.Unity.Container and then i could try it again. Except that i still had to add a reference to the Agatha.Unity project to this console project. So i opened the Edit References dialog and was very happy to see this:
I wasn’t happy because it’s a nice screen (which it isn’t) but because it showed up instantly. And notice that it lists all of the assemblies that are present in the GAC, which for some reason works instantly on Mono yet takes ages to do in Visual Studio 2008. I switched over to the Projects tab because i needed to select the Agatha.Unity project as a reference:
It’s nice to know that at least some developers can develop a reference-managing screen which enables you to manage your references in a fraction of the time it would take merely to load a similar screen in Visual Studio 2008, without having to resort to the workaround that will be used in Visual Studio 2010.
After that, the Hello World sample still didn’t work properly. The output of the asynchronously sent request wouldn’t show in the console output but there were no exceptions being thrown either. So i put a breakpoint in the request handler to make sure that it was at least being executed twice (once for the synchronous request, once for the asynchronous request):
I was glad to see the debugger actually break upon entering the breakpoint because that was one of the things that also didn’t work in the beta 1 release of MonoDevelop 2.2. But anyways, it hit this breakpoint twice so both Hello World requests were indeed handled, yet the response for the asynchronous request didn’t make its way to the console output for some reason. I added a breakpoint in the AsynchRequestDispatcher class to see if the response at least made its way into that part, and that’s when the debugging experience started to go wrong. After stepping through a couple of lines of code, it just stopped debugging and ran through the code as if there was no more debugger attached. I tried this a couple of times, always with the same result, except for 2 situations where the IDE would freeze, and the mono process holding both my CPU cores hostage at 100% usage. After about 8 attempts, i just gave up.
The MonoDevelop project certainly has made some huge improvements since the last time i tried it (3 months ago), but this should not have been a final release. Yes, you can finally write code in it. Yes, you can debug it. But no, it’s certainly not stable. Debugging can lead to hard crashes. Sometimes, the IDE doesn’t close properly and you have to kill the process. There was one case where i lost syntax highlighting and intellisense in one method while it still worked in other methods. Restarting MonoDevelop brought back the syntax highlighting and intellisense in that method. I also ran into some UI glitches where the GTK treeview used in the solution explorer no longer wanted to expand its items. I had to start clicking on other UI components before i could get the treeview to expand or collapse its items again. Sometimes, button clicks didn’t seem to be registered immediately and i had to click a couple of times. And no, it’s not a problem with my mouse since i don’t run into this with any other application. Though MonoDevelop is the only GTK application that i’ve used on this machine.
But still, if you think about the considerable improvements that the MonoDevelop team has made in the past 3 months, the remaining issues should probably be easy tasks to finish. Which makes it all the more frustrating that this final release seems to be rushed. Hopefully, the next release will make it a truly usable IDE for .NET on OS X.
As for the Mono project itself… i find it troubling that i can’t run my code on their latest 2.6.1 release. This is standard .NET code that runs perfectly fine on Microsoft’s .NET runtime and again, it should run exactly the same on Mono. And i always seem to run into issues with this whenever i try Mono. Yet at the same time, many people often claim that Mono is indeed a viable alternative for cross-platform .NET development. I can’t help but wonder if those people only seem to try very trivial stuff, or if they are actively working around bugs in the Mono libraries. I really want Mono to succeed, but so far, none of my attempts at running non-trivial .NET code on Mono have gone without problems. And i’m willing to bet that i’m not the only one, because that certainly would be a very, very big coincidence.

December 21st, 2009 at 3:09 pm
Just wanted to point out that had they not released, then you might not have given them a new test case! =)
December 21st, 2009 at 3:19 pm
well, the issues with MonoDevelop are things that they really should’ve noticed themselves after about 30 minutes of using it with something other than a typical Hello World application
as for the issues with Mono itself, that’s another story…
December 22nd, 2009 at 3:02 am
Hey, thanks for taking a look at MonoDevelop again. We always appreciate getting user feedback. I have a few comments on various points from your post.
* MD’s C# formatting options are “policies”, which means they’re per-solution (and can be overridden per-project). You can set the default format in the “Default policies” dialog. The formatting options panel in your screenshot is a vestigial panel for the smart indenter options that hasn’t been merged with the new system.
* When complaining that Mono doesn’t behave exactly like .NET, please consider that Mono is a cleanly reverse-engineered implementation of a HUGE framework, on top of different operating systems than it was designed for, and DOES try to be bug-compatible. However, complex software can turn up bugs or behavioural incompatibilities from time, and they’ll only get fixed if you file bug reports. It’s an open-source project, and is dependent on such contributions.
* To be fair to VS, the main reason the “add reference” dialog starts up so slowly is the COM tab, which MD doesn’t have. No idea why they didn’t background-load that tab’s contents though.
* The soft debugger is new since October, and there are still a few issues. Please file bug reports for any issues you encounter.
* If MD hangs, please issue a “kill -QUIT” against the MD process, which will cause it to write stacktraces of all threads to the MD log, then file the log in a bug report.
* The version of GTK+ that’s bundled with Mono on Mac (a heavily patched 2.17.4) has a number of issues, and losing track of mouse grabs is one of them. We’re in the process of rebasing the GTK patches on top of 2.18.x and trying to make sure there aren’t any regressions.
* We dogfood MonoDevelop 100% of the time when working on MonoDevelop, and it has over 600kloc, so is certainly a nontrivial app. It also works well on .NET on Windows.
December 22nd, 2009 at 10:35 am
@Michael
i can certainly understand that behavioral compatibility isn’t easy, though i would prefer it that the BCL classes are fully compatible before new API’s (like Silverlight) are implemented. The same effort that goes into implementing new API’s might be better spent making sure that what is already there actually works. If both the BCL classes and new API’s have incompatibilities, then you can’t really expect people to use Mono for real stuff. Sure, people can try to work around those bugs, but they really shouldn’t have to.
as for filing bug reports… i’d do that if the software was actually usable for me and the bugs i’d run into weren’t preventing me from getting anything done with it. At this point, i can’t use it at all for the stuff that i’m working on. I’d have to spend time on filing bug reports, creating samples that reproduce the problem, and then wait a few weeks/months before i can try again? I once filed a bug report (bug number 62293, though i can’t find the details of it anymore) on a regex memory leak in Mono a couple of years ago with a reproducible sample and it was ignored for a long time. Just as your time and resources are limited, so is mine and i prefer to spend it on stuff that doesn’t feel like a waste of time.