Saturday, 1 August 2009

Beware of differences between .NET and Mono

First, for those who don't know of what I'm talking about here, Mono is an open source implementation of .NET, and Moonlight (built on Mono) is an open source implementation of Silverlight. Though being (I bet it's not by accident) unclear about the legal situation of those who use Mono or Moonlight (two Novell products), Microsoft push Mono and Moonlight because it shows that .NET can work out of the box on Linux. Great.

Let's look at this a little more. I just read the last post from Jimmy Schementi's blog, a Microsoft developer who participate in the building of IronRuby, a .NET implementation of Ruby. The Microsoft team only works on the Microsoft .NET stack, but when IronRuby followers signal them bugs on Mono or Moonlight, they try fix the bug. At the end IronRuby is more or less working on Mono and Moonlight, meaning that it is working on Linux too. But.

This is the impression you have at first. But not all is working out of the box, and not because IronRuby still is in its 0.9 version. There's things that work in .NET but won't in Mono (Microsoft is in .NET 4.0, but Mono currently tracks the 2.0 version, and some things can not be emulated in Mono because it is to much tied to Windows), there's things that work in Silverlight and not in Moonlight (Moonlight is an implementation of Silverlight 2, but Silverlight has already reached version 3).

The contrary is also true. Mono and Moonlight allow things that can not be done on the "regular" .NET framework.

So beware if you think that code written for .NET / Slverlight will work out of the box. It won't, except if you are extra careful of using only things that are also available on the open source re-implementation. It reminds me of the differences between the Microsoft Java implementation and Sun's Java. It could work, or it could not work, depending on the situation.

But in these days it was not legal. Now it is, Microsoft has the right to do what it wants with .NET. I'm OK with that, but I also have the right not to play with all these .NET goodies. Right ?

P.S.: I have nothing against Jimmy Schementi's article. My only concern is that separating what works on one, two, or both implementation is not very clear in his post.