Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Limitation of Mono Runtime

Tags:

.net

mono

My question is similar to this one and this one, but there is a slight difference. So that's why I am asking it here.

I have a shiny .Net 3.5 Windows Service ( with NHibernate, LINQ, lambda expression) etc, running on Windows. Now I plan to port my app to Linux, so I am thinking about Mono.

Can I just compile my .net app in Windows, and copy it to a Linux machine with .Net ( mono version) installed, and expect it to run smoothly? If not, is there anything I should do?

Any answers or pointers are welcome.

like image 362
Graviton Avatar asked Jun 28 '09 06:06

Graviton


3 Answers

Will it just work? You really have to test it. I've just recently put effort into making Protocol Buffers work on Mono. I've had very little execution-time trouble so far; the compiler was more of an issue for me. However, I've had to temporarily disable one of the unit tests (using mocking) because it makes the Mono 2.4 VM itself go bang. I haven't investigated why yet, but that sort of thing is basically impossible to predict.

Anything which uses "deep" aspects of the CLR - such as expression trees and dynamic methods - is likely to have more problems than simple libraries, IMO.

Now, you say it's a Windows service - obviously Linux doesn't have services in quite the same way as Windows, so you'll need to work out how you want it to run. I'd start off by running it as a simple console app if I were you... once it's all working, you can think about integrating it with other "service" controllers etc - if you find you need to.

It certainly used to be the case that xbuild didn't provide a seamless migration path from building on Windows to building on Linux... however, it's had a lot of attention recently, so it's worth trying again...

like image 89
Jon Skeet Avatar answered Oct 19 '22 18:10

Jon Skeet


Start by using the MoMA tool

The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have when porting your .Net application to Mono. It helps pinpoint platform specific calls (P/Invoke) and areas that are not yet supported by the Mono project. While MoMA can help show potential issues, there are many complex factors that cannot be covered by a simple tool. MoMA may fail to point out areas that will cause problems, and may point out areas which will not actually be an issue

From Personal point: All C# 3.0 feature are supported well, I had no problem with LINQ (To Objects, don't know about LINQ to SQL or to XML) and NHiberinate also works well (although I didn't end up using in)

like image 42
Shay Erlichmen Avatar answered Oct 19 '22 20:10

Shay Erlichmen


The runtime should be fine but you can run the Mono Migration Analyzer.

like image 42
weiqure Avatar answered Oct 19 '22 20:10

weiqure