This is a topic that many of us mono developers know really well. but many of you might be new to mono or maybe even just merely fans of mono. Maybe you syndicate mono’s monologue feed but never really have had a chance to use it, but because its .NET related, its interesting. These tips might interest you.

Even though you might not plan on using Mono in its entirety, parts of Mono can help you with your .NET development. From a evangelist respect, I would love everyone to use Mono, but being a developer I know that isn’t always possible. Fear not, you might still be able to use Mono to speed your time to market, solve some of the issues you might be having, and more conventionally help you understand where you might have portability issues in the future.

Use Mono’s source as reference guide
First off, its good to know where you can see the mono class library source. The best way to view the source online without downloading is using the SVN viewer. Bookmark this url: http://svn.myrealbox.com/viewcvs/trunk/mcs/class/.

Even though our class libraries don’t work 100% exactly the same as in .NET, we modeled them to match .NET as close as we possibly could. If you know C#, they are easy to understand in most cases, and sometimes its more useful looking at the source code to see what a function returns, then to poking around in the MSDN docs when something isn’t specific enough and just testing things over and over takes to much time.

One example where I found this useful today is when I had an error in some 3rd party code that ran peek on a stream reader to see if there was any data to be read. Simply reading the source I noticed that really it just checks the Stream.CanRead property and since peak would return a char and the stream defaulted to UTF8 and since the byte value it was reading didn’t exist in the UTF8 encoding, it would crash.

Mono’s Secuirty and LDAP libraries
If you need more then what System.Secuirty and System.DirectoryServices offer you, you can use our Mono.Secuirty and Novell’s LDAP assemblies in your app. They are written in C# and copy nicely being CLI compliant and all, so they run on .NET without issue.

Use Mono class libraries to supplement missing APIs in Windows CE .NET
While I haven’t done this, if you really need something that isn’t offered in the CE edition of .NET, then mono’s implementation might be exactly what you need. Our class libraries are writen in C#, we try to minamize as many calls to native functions as possible (doesn’t help when we want to keep things portable). All you need to do is strip out what you need and refactor it in to your source.

Oh did I mention that Mono’s class libraries are released under the MIT/X11 licence? MIT/X11 is one of the most liberal licences out there. That means you can almost do anything you want with the source without risk of any licence clause stopping you.

Monodis
This is a small one. It’s our version of ildasm. I found that it can break down assemblies to IL a bit clearer then ildasm. One of the great uses is when you run into some library in-lined with some hack to prevent ildasm from working, monodis sometimes still works.

Broken/Missing feature in your favorite ASP.NET control?
This happened to me a few times. You want that DataGrid or DataList or Calendar object to do something it just doesn’t have the power to do. What do you do? You take the version in Mono’s System.Web namespace, change it, and compile and enjoy.

For example, lets say you want a 14 day calendar or a calendar that shows 14 days in a row? Simply snatch the code (http://svn.myrealbox.com/viewcvs/trunk/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs?view=markup), make the few changes you need, and enjoy! You just saved yourself a ton of time hacking something yourself.

Managed.Windows.Forms
Our System.Windows.Forms stack is completely written using System.Drawing/GDI+ (makes it very portable). One of the advantages is that the controls we wrote can be modified and refactored with little effort into MS.NET. Let’s stay you want a text box that does all sorts of colors, or you want a rich text box that supports some crazy feature (like shadowed text or something). Just like the asp.net control example above, you can strip out what you want and make it happen, in a fraction of the time.

Mono Tools for Visual Studio
My good friend Paco Martinez is the Win32 king. He has put together a number of projects that integrate with Visual Studio to help you check your code against mono as you develop. You can see most of his packages on Novell Forge here and here. His tools are a must have.

XSP
Simply, because its better then Cassini for a standalone ASP.NET server. Also the licence allows for distribution, so you can package your ASP.NET up for people to run on machines without IIS and not have to worry about restrictions or limitations compiled in. XSP is also the back end to our mod_mono module for apache, so you are not using a diluted version.

Mono’s Debugger
Ok.. It’s not visual studio. But many people who are used to gdb or any other command line debugger, may find its familiar and useful.

Complete Control
This really isn’t a tip but an example. I’m personally aware of one company that has taken and extended Mono’s web-service stack into their own code to improve compatibility with Java and write in support to expose and consume methods with XML-RPC in the same layer.

Mono can be an invaluable tool. I know it has been for me over the last couple of years in my own development.