Mono Migration Analyzer 1.0

Update: Moma 1.0 reports some false positives, see the post here for some explanations.

Jonathan Pobst wrote a very nice tool, the Mono Migration Analyzer (Moma) a tool that can be used by Windows .NET developers to evaluate whether their software will need any modifications to run on the Mono supported platforms, here is the welcome screen:

Moma works by analyzing all the instructions that the code contains and all the references to external types and assemblies (.exe and .dll files). The analysis is done using Cecil, a library used to examine, introspect and manipulate ECMA CIL images.

The first step is to select the assemblies to analyze:

During the analysis, Moma will look for any references to methods, fields, properties or events that the program does on external assemblies and report any of the following problems:

  • Using un-implemented classes, methods or accessing missing properties or fields.
    This would happen for example if a piece of functionality that developers expect is not yet available on Mono (most likely, 2.0 features).
  • Calls to methods, references to fields or types that have been flagged with the special "MonoTODO" attribute.
    Class libraries in Mono, when incomplete, are flagged with an attribute, like this:
    	[MonoTODO ("In Mono this is controlled by the --share-code flag")]
    	public LoaderOptimization LoaderOptimization {
    		// implementation details.
    	}
    		

    If your program uses the above property, Moma will provide a warning with the above text.
  • P/Invoke invocations. P/Invoke has two uses: to call into your own unmanaged libraries, or to call into Win32 APIs that are not exposed in the .NET API.
    Moma will report all uses of P/Invoke (uses, not declarations; A lot of people include a lot of declarations that they never use).
  • Any methods in Mono whose signature exists, but that throws a NotImplementedException when called.

After analyzing your code, Moma will then present a summary of the issues found in your application:

The report is a summary of the issues identified by Moma. You can get a detailed report of issues by clicking on "View Detailed Report". This new report is what you will be using when you go through your application making sure that your code is portable, the report looks like this:

Finally, you can help us prioritize which classes and features are most important, you can do so by submitting the report to our team:

Early Experiences

I used Moma in a couple of applications from third party vendors that we are interested in bringing to Linux. The results so far are very promising as we are not missing that much.

The majority of the problems so far have been in sections of code that P/Invoke to get to some features not available in the framework, things like preferences, recently used documents, CPU detection and a handful of features to get information about windows, items on the screen and a few more.

To help port those applications we will be creating a portability assembly that will provide an API that Windows developers can call and will provide the proper native equivalent on Linux, Windows and OSX.

Getting Moma

You can download Moma 1.0.1 from here.

Update New version is here.

Posted on 27 Nov 2006 by Miguel de Icaza
This is a personal web page. Things said here do not represent the position of my employer.