I know the converse is not true, but if my application works using Mono is it guaranteed to work if I switch to the real deal? If not, where can I find a list of caveats?
Mono implements the CLR on Linux, Mac, and other platforms. The Mono runtime (the CLR) is a native application written mostly in the C language and compiled down to machine language code for the computer system on which is designed to run.
The Mono C# compiler is considered feature complete for C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0 and C# 6.0 (ECMA) and it has partial support for C# 7.
Both Mono and .NET are supersets of the ECMA/ISO CLI family of specifications. However, neither .NET nor Mono are subsets of the other. Both Mono and .NET add features on top of ECMA/ISO CLI, but while Mono implements many of .NET's additions, .NET does not implement any of Mono's additions.
Here's a few examples:
Note, however, that (except for the arrays), all of these are clearly distinguishible by their namespaces, since none of them live in the System
or Microsoft
namespaces.
EDIT: Actually, most of the above-mentioned extensions are explicitly designed to also work on .NET. For example, Mono.Simd
also runs on .NET, but without the runtime support that the Mono VM has, it's unusably slow. (Basically, all the SIMD operations are implemented in C#, but the Mono compiler detects those calls and replaces them with their corresponding assembly instructions. That way, they work on .NET, but without the special treatment, they are significantly slower.) Also, the C# REPL is currently being re-implemented on top of Reflection.Emit
(at the moment, it calls the Mono compiler directly), so that it will work on .NET in the future. Gtk# works just fine on Windows and .NET.
Only the Mono.Tasklet
library cannot be implemented on .NET, since it requires VM-level support for continuations.
No. Mono includes several alternative UI frameworks (Gtk#, wxWindows for .NET, etc).
If you only use Microsoft-defined classes, though, you should be fine.
Mono is an implementation of the CLI standard, as is the CLR.
It includes many of the libraries you would find in the .NET BCL, but not any that are windows specific (WMI is one whole domain that comes to mind).
So long as you keep to features that are not windows specific, you should be fine.
The mono team have created a tool to check if your code should work on mono - MoMA, the Mono Migration Analyzer.
As far as using mono code with the Microsoft compilers, so long as you include the libraries you are using and are not doing any pInvokes on linux, you should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With