Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

Test your .Net Application with Mono Migration Analyzer

Posted by Keith Elder | Posted in Uncategorized | Posted on 20-04-2007

For those of you that aren’t involved at all with open source software the Mono project is an open source effort to run .Net applications on various platforms. 

About Mono

If you watch Miguel from Novell speak about the Mono project the main reason they started it is to be able to open up more application to the Linux platform.  One way to do this is to write them from scratch.  The other is to use what is already out there.  Linux has browsers, music players and is good at server protocols but lacks productivity business entrenched applications (I’m not talking about openoffice, go deeper).  Examples Miguel has given are medical applications, finance applications and more.   This is where Microsoft has a strong application base and these are the apps that Linux doesn’t have today.  So instead of writing those apps from scratch, Mono would provide a way to run those applications without having to rewrite all the code.  Definitely a noble project to bring more applications to the Linux platform.

It never fails when I talk to one of my friends who is heavily involved with open source software they bring up Mono.  They of course know that I do .Net development and they quickly ask, “Hey, why don’t you use mono and run your applications on Linux?”  My first response (after I slap them for being stupid) is to point out that Mono still has a long way to go to be completely compatible with .Net. 

Trust me when I say I would love to be able to write a .Net application, run it on Windows, then run it on Linux or Mac OS X with no effort.  The problem is we just aren’t there today.  I think one day we’ll get there and I will rejoice when we do.  Until then I’ll check into the Mono project and see how things are progressing every now and then.  Tonight is one of the those “I’m checking in to see where things are at” nights. 

Console Application Analyzed

There is an easy tool we can use to test our .Net applications to see if they are compatible using Mono.  It is called the Mono Migration Analyzer.  Once you download it launch the executable and add a DLL or EXE you want to analyze for compatibility.  The first thing I checked was a simple console application we wrote the other day to parse a bunch of XML files on a network share and then submit those into a web service. 

The console application is apparently compatible with Mono.  This is good because I could send it to a Unix admin at work and have him run it in a cron job or something.  That is pretty cool. 

Simple Winform Application Analyzed

Next I went with a slightly more complicated WinForm app.   I took a utility WinForm app that I built to replay Soap Messages.  Sometimes we get emails when soap requests blow up and we need to either replay them to debug them or simply just resubmit the message once we fix a bug.  This is the utmost simple windows form you could probably build.  Here it is:

Once you get over the initial shock of how cool my user interface design is, you’ll notice that it isn’t complicated at all. There is a textbox where you put a soap message, a SoapAction textbox, and you select the URL you want to post to in the drop down.  Press the button and away the message goes.  Here we see our first problem, but not too bad using the analyzer.

As you can see we have 3 MonoTodo’s flagged.  Here is the report:

 

Nothing too major in the report.  Mostly just some resize calls from the InitializeComponent() in the constructor of the form.  I suspect this form would in fact work on Linux.  As a utility it is pretty handy.  Thus far, yeah! I have two .Net apps I can now run on Linux although they really haven’t provided much value for my business.  Let’s try one of those next. 

The Real Test

After the first two tests were successful I wanted to throw a “real” business application at Mono.  What I mean by “real” application is an enterprise level application that was built from scratch using .Net 2.0, the type of application that adds value and is used 24/7.   This should REALLY test where the Mono project is from a holistic standpoint.  I checked the latest source code out for our in-house .Net 2.0 CRM application.  I then did a build and pointed the analyzer at the files.  The results were not so shiny.  Lots of red.  Here’s the results.

Methods that are still missing in Mono: 1878
P/Invokes called : 10
Methods called that throw NotImplementedException: 168
Methods called marked with [MonoTodo]: 831

Wow, that’s not as rosy as the first two simple tests needless to say.  Hopefully this will prove to some of my friends that Mono isn’t ready for prime time yet so they’ll shutup and leave me alone about it for at least another year.  For simple stuff its ok, for anything that is more complicated, not so great (yet). 

Miguel, I’m rooting for you though!  You only have 1878 methods to fix and 831 Methods marked as todos before we can run our CRM in Mono.  I’m also rooting for you to break through the web hosting space so Linux hosts can host Asp.Net applications, something that is needed.  That’s my nightly report, I’ll check in about a year out to see where we are at then.

 

Technorati tags: ,

Comments (5)

Mono Less Than One Year Later

Supercheetah,

Good idea, I think I will run these tests again to see what has changed. Watch for that article coming soon.

As far as real world uses of Mono, check out Second Life. This is about the only one I have heard of though. They (Second Life) announced that they will be replacing their LSL scripting language with mono which will open up scripting in Second Life to run VB or C# code as well as support more features. Miguel recently blogged about this.

As far as hosting Asp.Net applications go, hosting providers running Linux are steering clear of Mono at the moment because of security concerns. Maybe within another year we’ll see it make more headway.

-Keith

It’s been almost a year since this article came out. Apparently de Icaza and team have worked really hard to get a lot of those functions in there. You should try this test again.

By the way, does anyone use Mono for any serious projects, especially under Linux? Most of the stuff I’ve seen seem to be, “Look, I can do this too,” kind of projects. I don’t know anyone that, say, uses ASP.NET under Linux (I know a few people that have experimented with it, but that’s about it), especially for hosting stuff.

After reading this, I was curious and had our resident mono fan try running that on our frame work, it had like 500 methods/300 todos. Almost all of them though were the same, and almost all of them were designer classes for our custom controls.

BTW, there is a really good interview with Miguel that took place recently at this URL: http://derstandard.at/?id=2818611&_index=0

Write a comment