Mono tech
Mono is a free and open-source project led byXamarin, a subsidiary of Microsoft[3] (formerly by Novell and originally by Ximian), and the.NET Foundation, to create an Ecma standard-compliant, .NET Framework-compatible set of tools including, among others, a C# compilerand a Common Language Runtime. The logo of Mono is a stylized monkey's face, monobeing Spanish for monkey.[4]
The stated purpose of Mono is not only to be able to run Microsoft .NET applications cross-platform, but also to bring better development tools to Linux developers.[5] Mono can be run on many software systems including Android, most Linux distributions, BSD, macOS,Windows, Solaris, and even some game consoles such as PlayStation 3, Wii, and Xbox 360.
The Mono project has been controversial within the open-source community, as it implements portions of .NET Framework that may be covered by Microsoft patents. Although standardized portions of .NET Framework are covered under Microsoft's"Open Specification Promise"—a covenant stating that Microsoft will not assert its patents against implementations of its specifications under certain conditions—other portions are not, which led to concerns that the Mono project could become the target ofpatent infringement lawsuits. Following Microsoft's open-sourcing of several core .NET technologies since 2014 and its acquisition of Xamarin in the beginning of 2016, an updated patent promise has been issued for the Mono project (§ Mono and Microsoft's patents).
History
When Microsoft first announced their .NET Framework in June 2000 it was described as "a new platform based on Internet standards",[32] and in December of that year the underlying Common Language Infrastructure was published as an open standard, "ECMA-335",[33] opening up the potential for independent implementations.[34]Miguel de Icaza of Ximian believed that .NET had the potential to increase programmer productivity and began investigating whether a Linux version was feasible.[35] Recognizing that their small team could not expect to build and support a full product, they launched the Mono open-source project, on July 19, 2001 at the O'Reilly conference.
After three years' development, Mono 1.0 was released on June 30, 2004.[36] Mono evolved from its initial focus of a developer platform for Linux desktop applications to supporting a wide range of architectures and operating systems - including embedded systems.[37]
Novell acquired Ximian in 2003. After Novell was acquired by Attachmate in April 2011, Attachmate announced hundreds of layoffs for the Novell workforce,[38] putting in question the future of Mono.[39][40]
On May 16, Miguel de Icaza announced in his blog that Mono would continue to be supported by Xamarin, a company he founded after being laid off from Novell. The original Mono team had also moved to the new company. Xamarin planned to keep working on Mono and had planned to rewrite the commercial .NET stacks for iOS and Androidfrom scratch, because Novell still owned MonoTouch and Mono for Android at the time.[41] After this announcement, the future of the project was questioned, MonoTouch and Mono for Android being in direct competition with the existing commercial offerings now owned by Attachmate, and considering that the Xamarin team would have difficulties proving that they did not use technologies they formerly developed when they were employed by Novell for the same work.[42] However, in July 2011, Novell, now a subsidiary of Attachmate, and Xamarin, announced that it granted a perpetual license to Xamarin for Mono, MonoTouch and Mono for Android, which officially took stewardship of the project.[43][44]
Current status and roadmap
Mono's current version is 5.4.0 (as of October 2017). This version provides the core API of the .NET Framework and support for Visual Basic.NET and C# 7.0. LINQ to Objects, XML, and SQL are part of the distribution. Windows Forms 2.0 is also supported, but not actively developed, and as such its support on Mono is incomplete.[45] Version 4.0 is the first version that incorporates Microsoft original source code that was released by Microsoft as part of the .NET Core project.
Mono's aim is to achieve full support for the features in .NET 4.5 except Windows Presentation Foundation (WPF) (which the Mono team do not plan to support due to the amount of work it would need),[45] Windows Workflow Foundation (WF), limited Windows Communication Foundation (WCF).[46] Some missing parts of the .NET Framework are under development in an experimental Mono subproject called Olive.[47]
The Mono project has also created a Visual Basic .NET compiler and a runtime designed for running VB.NET applications. It is currently being developed by Rolf Bjarne Kvinge.
Moonlight
An open-source implementation of Microsoft Silverlight, called Moonlight, has been included since Mono 1.9.[48] Moonlight 1.0, which supports the Silverlight 1.0 APIs, was released January 20, 2009. Moonlight 2.0 supports Silverlight 2.0 and some features of Silverlight 3.0.[49] A preview release of Moonlight 3.0 was announced in February 2010 and contains updates to Silverlight 3 support.[50]
The Moonlight project was abandoned on May 29, 2012.[51] According to Miguel, two factors sealed the fate of the project: Microsoft added "artificial restrictions" that"... made it useless for desktop programming ...", and the technology had not gained enough traction on the Web.
Mono components
Mono consists of three groups of components:
- Core components
- Mono/Linux/GNOME development stack
- Microsoft compatibility stack
The core components include the C# compiler, the virtual machine for the Common Language Infrastructure and the core class libraries. These components are based on theEcma-334 and Ecma-335 standards,[52]allowing Mono to provide a standards compliant, free and open-source CLI virtual machine. Microsoft issued a statement that covers both standards under their Community Promise license.[53]
The Mono/Linux/GNOME development stackprovide tools for application development while using the existing GNOME and free and open-source libraries. These include: Gtk# forgraphical user interface (GUI) development, Mozilla libraries for working with the Gecko rendering engine, Unix integration libraries (Mono.Posix), database connectivity libraries, a security stack, and the XML schema language RelaxNG. Gtk# allows Mono applications to integrate into the Gnome desktop as native applications. The database libraries provide connectivity to the object-relational database db4o, Firebird, Microsoft SQL Server (MSSQL), MySQL, Open Database Connectivity (ODBC), Oracle, PostgreSQL,SQLite, and many others. The Mono project tracks developing database components at its website.[54]
The Microsoft compatibility stack provides a pathway for porting Windows .NET applications to GNU/Linux. This group of components include ADO.NET, ASP.NET, andWindows Forms, among others. As these components are not covered by Ecmastandards, some of them remain subject topatent fears and concerns.
Framework architecture
The major components of Mono include:
- Code Execution Engine
- Class Libraries
- Base Class Library
- .NET Compatibility Class Libraries
- Mono specific class libraries:
- Cross platform class libraries for both Mono and .NET (Gtk#, Mono.Cecil, Mono.CSharp, Text.Templating)
- Unix-specific class libraries (POSIX, Filesystem in Userspace(FUSE), curses)
- Platform-specific class libraries (bindings for: Mac, iOS, Android, MeeGo)
- CLI Assemblies
- CLI Metadata
- Mono's Common Language Runtime
- Compatible with the ECMA Common Language Infrastructure/.NETCommon Language Runtime
- Mono-specific enhancements:
- Mono.SIMD support
- Mono co-routines and continuations.
- Mono-specific enhancements
- Native interop services and COM interop
- Security - Transparent Code Framework
Code Execution Engine
The Mono runtime contains a code execution engine that translates ECMA CIL byte codes into native code and supports a number of processors: ARM, MIPS (in 32-bit mode only),SPARC, PowerPC, S390 (in 64-bit mode), x86,x86-64 and IA-64 for 64-bit modes.
The code generator is exposed in three modes:
- Just-in-time (JIT) compilation: The runtime will turn ECMA CIL byte codes into native code as the code runs.
- Ahead-of-Time (AOT) compilation: this code turns the ECMA CIL byte codes (typically found on a .exe or .dll file) and generates native code stored in an operating system, architecture and CPU specific file (for a foo.exe file, it would produce foo.exe.so on Linux). This mode of operation compiles most of the code that is typically done at runtime. There are some exceptions liketrampolines and other administrative code that still require the JIT to function, so AOT images are not fully standalone.
- Full Static Compilation: this mode is only supported on a handful of platforms and takes the Ahead-of-Time compilation process one step further and generates all the trampolines, wrappers and proxies that are required into a static file that can be statically linked into a program and completely eliminates the need for a JIT at runtime. This is used on Apple's iOS, Sony'sPlayStation 3 and Microsoft's Xbox 360operating systems.[citation needed]
Starting with Mono 2.6, it is possible to configure Mono to use the LLVM as the code generation engine instead of Mono's own code generation engine. This is useful for high performance computing loads and other situations where the execution performance is more important than the startup performance.
Starting with the Mono 2.7 preview, it is no longer necessary to pick one engine over the other at configuration time. The code generation engine can be selected at startup by using the
--llvm
or --nollvm
command line arguments, and it defaults to the fast Mono code generation engine.Garbage collector
As of Mono 2.8, the Mono runtime ships with two garbage collectors: a generational collector[55] and the Boehm conservative collector.
The default garbage collector prior to Mono 3.1.1 (the Boehm-Demers-Weiser Conservative Garbage Collector),[55][56] has significant limitations compared to commercial garbage-collected runtimes like the Java Virtual Machine or the .NET framework's runtime. Because the garbage collector can exhibitmemory leaks on certain classes of applications, it may be unsuitable for long-running server applications.
As of October 2010, a new generational collector called the Simple Generational GC(SGen-GC) became available as part of Mono. Starting with Mono 3.1.1 this is the default. For versions of Mono from 2.8 to 3.1.0, users can elect to use the SGen garbage collector by passing the
--gc=sgen
switch to the Mono runtime at startup.[55] This new garbage collector has many advantages over a traditional conservative scanner. It usesgenerational garbage collection where new objects are allocated from a nursery, during the garbage collection cycle, all objects that survived are migrated to an older generation memory pool. The idea being that many objects are transient and can quickly be collected and only a handful of objects are long-term objects that live for the entire life of the application. To improve performance this collector assigns memory pools to each thread to let threads allocate new memory blocks without having to coordinate with other threads. Migration of objects from the nursery to the old generation is done by copying the data from the nursery to the old generation pool and updating any live pointers that point to the data to point to the new location. This can be expensive for large objects, so Mono's SGen uses a separate pool of memory for large objects (Large Object Section) and uses a mark-and-sweep algorithm for those objects.
Currently SGen treats the stack and registers conservatively and pins any objects that could be referenced by any of these roots. The upcoming version of Mono scans the managed stack precisely, reducing the number of pinned objects.
Class library
The class library provides a comprehensive set of facilities for application development. They are primarily written in C#, but due to the Common Language Specification they can be used by any .NET language. The class library is structured into namespaces, and deployed in shared libraries known as assemblies. Speaking of the .NET framework is primarily referring to this class library.[57]
Namespaces and assemblies
Namespaces are a mechanism for logically grouping similar classes into a hierarchical structure. This prevents naming conflicts. The structure is implemented using dot-separated words, where the most common top-level namespace is System, such as System.IO and System.Net. There are other top-level namespaces as well, such as Accessibility and Windows. A user can define a namespace by placing elements inside a namespace block.
Assemblies are the physical packaging of the class libraries. These are .dll files, just like (but not to be confused with) Win32 shared libraries. Examples of assemblies are mscorlib.dll, System.dll, System.Data.dll and Accessibility.dll. Namespaces are often distributed among several assemblies and one assembly can be composed of several files.
Common Language Infrastructure and Common Language Specification
The Common Language Infrastructure (CLI), or more commonly known as the Common Language Runtime, is implemented by the Mono executable. The runtime is used to execute compiled .NET applications. The common language infrastructure is defined by the ECMA standard.[52] To run an application, you must invoke the runtime with the relevant parameters.
The Common Language Specification (CLS) is specified in chapter 6 of ECMA-335 and defines the interface to the CLI, such as conventions like the underlying types for Enum. The Mono compiler generates an image that conforms to the CLS. This is the Common Intermediate Language. The Mono runtime takes this image and runs it. The ECMA standard formally defines a library that conforms to the CLS as a framework.
Managed and unmanaged code
Within a native .NET/Mono application, all code is managed; that is, it is governed by the CLI's style of memory management and thread safety. Other .NET or Mono applications can use legacy code, which is referred to as unmanaged, by using the System.Runtime.InteropServices libraries to create C# bindings. Many libraries which ship with Mono use this feature of the CLI, such asGtk#.
Mono-specific innovations
Mono has innovated in some areas with new extensions to the core C# and CLI specifications:
- C# Compiler as a Service (Use the C# compiler as a library).[15]
- C# Interactive Shell.[16]
- SIMD support[14] as part of the Mono.SIMD namespace, where method calls to special vector types are directly mapped to the underlying processor CPU SIMD instructions.
- Full static compilation of .NET code[58](used on Mono/iPhone, Mono/PS3).
- Mono coroutines (used to implement micro-threading code and continuations, mostly for game developers).[59]
- Assembly injection to live processes.[60]
- Use of LLVM as JIT backend.
- Cxxi and CppSharp direct interop with C++ code and libraries.
In addition, Mono is available on a variety of operating systems and architectures.[61]
System requirements
Windows XP, Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, MacOSX or Linux
Related projects
Several projects extend Mono and allow developers to use it in their development environment. These projects include:
Cross-platform:
- Banshee Media Player (stalled), a cross-platform music media player built with Mono and Gtk# and also a driver of dozens of C#-based libraries and projects for media handling.
- Beagle (unmaintained), a search system for Unix systems.
- Gecko#, bindings for embedding the layout engine used in Mozilla (Gecko).
- Gtk#, C# wrappers around the underlyingGTK+ and GNOME libraries, written in C and available on Linux, MacOS and Windows.
- Mono Migration Analyzer (MoMA), a tool which aids Windows .NET developers in finding areas in their code that might not be cross-platform and therefore not work in Mono on Linux and other Unixes.
- MonoCross, a cross-platform model–view–controller design pattern where the Model and Controller are shared across platforms and the Views are unique for each platform for an optimized User Interface. The framework requires Xamarin.iOS and Xamarin.Android.
- MvvmCross, a cross-platform Model View ViewModel framework utilizing Xamarin.iOS and Xamarin.Android for developing mobile apps.
- MonoDevelop an open-source and cross-platform integrated development environment that supports building applications for ASP.NET, Gtk#, Meego, MonoTouch and Silverlight/Moonlight.
- Moonlight (discontinued), an implementation of Silverlight that uses Mono.
- OpenTK, a managed binding for OpenGL, OpenCL and OpenAL.
- QtSharp, C# bindings for the Qt framework.
- Resco MobileBusiness, a cross-platform developer solution for mobile clients.
- Resco MobileCRM, a cross-platform developer solution for mobile clients synchronized with Microsoft Dynamics CRM.
- ServiceStack a high-performance open-source .NET REST web services framework that simplifies the development of XML, JSON and SOAP web services.
- SparkleShare an open-source client software that provides cloud storage and file synchronization services.
- Tao (superseded by OpenTK), a collection of graphics and gaming bindings (OpenGL, SDL, GLUT, Cg).
- Xwt, a GUI toolkit that maps API calls to native platform calls of the underlying platform, exposing one unified API across different platforms and making possible for the graphical user interfaces to have native look and feel on different platforms. It enables building GUI-based desktop applications that run on multiple platforms, without having to customizing code for different platforms. Xwt API is mapped to a set of native controls on each supported platform. Features that are not available on specific platforms are emulated by using native widgets, which is referred to as hosting in the Xwt context.[62] Xwt was partially used as GUI toolkit (beside GTK#) in the development of the Xamarin Studio.[63] Supported "backend" engines are:WPF engine and Gtk engine (using Gtk#) onWindows, Cocoa engine (using MonoMac) and Gtk engine (using Gtk#) on Mac OS X, and Gtk engine (using Gtk#) on Linux.[64]
macOS:
- Cocoa# – wrappers around the native macOS toolkit (Cocoa) (deprecated).
- Monobjc – a set of bindings for macOS programming.
- MonoMac – newer bindings for macOS programming, based on the MonoTouch API design.
Mobile platforms:
- MonoDroid. Mono for the Android operating system. With bindings for the Android APIs.
- MonoTouch. Mono for the iPhone, iPad and iPod Touches. With bindings to the iOS APIs.
Windows:
- MonoTools for Visual Studio A Visual Studio plugin that allows Windows developers to target Linux and macOS right from Visual Studio and integrates withSUSE Studio.
Other implementations
Microsoft has a version of .NET 2.0 now available only for Windows XP, called theShared Source CLI (Rotor). Microsoft's shared source license may be insufficient for the needs of the community (it explicitly forbids commercial use).
MonoDevelop
MonoDevelop is a free GNOME integrated development environment primarily designed for C# and other .NET languages such asNemerle, Boo, and Java (via IKVM.NET), although it also supports languages such asC, C++, Python, and Vala. MonoDevelop was originally a port of SharpDevelop to Gtk#, but it has since evolved to meet the needs of Mono developers. The IDE includes class management, built-in help, code completion, Stetic (a GUI designer), project support, and an integrated debugger.
The MonoDoc browser provides access to API documentation and code samples. The documentation browser uses wiki-style content management, allowing developers to edit and improve the documentation.
Xamarin.iOS and Xamarin.Android
Xamarin.iOS and Xamarin.Android, both developed by Xamarin, are implementations of Mono for iPhone and Android-based smartphones. Previously available only for commercial licensing,[66] after Microsoft's acquisition of Xamarin in 2016, the Mono runtime itself was relicensed under MIT license[67] and both Xamarin.iOS and Xamarin.Android are being made free and open-source.[68]
Xamarin.iOS
Xamarin.iOS (previously named MonoTouch) is a proprietary library that allows developers to create C# and .NET based applications that run on the iPhone, iPod and iPad devices. It is based on the Mono framework and developed in conjunction with Novell. Unlike Mono applications, Xamarin.iOS "Apps" are compiled down to machine code targeted specifically at the Apple iPhone and iPad.[77]This is necessary because the iOS kernel prevents just-in-time compilers from executing on the device.
The Xamarin.iOS stack is made up of:
- Compilers
- C# from the Mono Project
- Third-party compilers like RemObject's Oxygene can target Xamarin.iOS also
- Core .NET libraries
- Development SDK:
- Linker – used to bundle only the code used in the final application
- mtouch – the Native compiler and tool used to deploy to the target device
- Interface Builder integration tools
- Libraries that bind the native CocoaTouch APIs
- Xamarin Studio IDE
Xamarin Studio is used as the primary IDE, however additional links to Xcode and the iOS simulator have been written.
From April to early September 2010, the future of MonoTouch was put in doubt as Apple introduced new terms for iPhone developers that apparently prohibits them from developing in languages other than C, C++ and Objective-C, and the use of a middle layer between the iOS platform and iPhone applications. This made the future of MonoTouch, and other technologies such asUnity, uncertain.[78] Then, in September 2010, Apple rescinded this restriction, stating that they were relaxing the language restrictions that they had put in place earlier that year.[79][80]
Xamarin.Android
Xamarin.Android (formerly known as Mono for Android), initially developed by Novell and continued by Xamarin, is a proprietary[81]implementation of Mono for Android-based smart-phones.[82][83][84] It was first released on April 6, 2011.[85] Mono for Android was developed to allow developers to more easily write cross-platform applications that will run on all mobile platforms.[86] In an interview with H-Online, Miguel de Icaza stated, "Our vision is to allow developers to reuse their engine and business logic code across all mobile platforms and swapping out the user interface code for a platform-specific API."[87]
In August 2010, a Microsoft spokesman, Tom Hanrahan of Microsoft's Open Source Technology Centre, stated, in reference to the lawsuit filed by Oracle against Google over Android's use of Java, that "The type of action Oracle is taking against Google over Java is not going to happen. If a .NET port to Android was through Mono it would fall under theMicrosoft Community PromiseAgreement."[88][89]
The Xamarin.Android stack consists of the following components:
- Mono runtime
- An Android UI designer[90]
- Libraries:
- Core .NET class libraries
- Libraries that bind the native Android/Java APIs
- SDK tools to package, deploy and debug
- Xamarin Studio and Visual Studio 2010 integration to design the UI, remotely debug, and deploy.
Comments
Post a Comment