Xamarin and the Mono Project community are still working to integrate Microsoft’s open-source Roslyn compiler into Mono.
In a post on his personal blog, Xamarin CTO Miguel de Icaza detailed the Xamarin and Mono efforts on two fronts: using Roslyn as Mono’s default compiler, and as its IDE engine powering code completion and refactoring. Over the past year, the teams have worked to replace the current Mono engine (a combination of the NRefactory library and Mono C# compiler) with Roslyn.
De Icaza revealed the Mono Project has completed a feature-complete Roslyn-powered MonoDevelop branch in Xamarin Studio, leveraging Roslyn for code completion, refactoring, suggestions and code formatting. Xamarin has also ported NFactory refactoring to work atop Roslyn in Visual Studio using an extension. The branch isn’t quite ready yet, though, according to de Icaza.
(Related: Mono brings .NET to Android)
“While our Roslyn branch is working great and is a pleasure to use, it also consumes more memory and, by extension, runs a little slower,” he said. “This is not Roslyn’s fault, but the side effects of leaks and limitations in our code. Our original plan was to release this for our September release [Cycle 6], but we decided to pull the feature out from the release to give us time to fix the leaks that affected the Roslyn engine and tune the performance of Roslyn running on Mono.”
Xamarin now plans to ship a tooling update in tandem with a Roslyn-enabled MonoDevelop/Xamarin Studio preview in September while it fixes the memory usage issues.
As for Roslyn as Mono’s default compiler, Mono’s master release now contains support for using Portable Program Database (PPDB) files, allowing Roslyn to produce Mono debug information. PPDB file support was added to Roslyn this month, lifting what de Icaza described as a major roadblock to Mono adoption of Roslyn.
“The initial Roslyn release only had support for generating debug information through a proprietary/native library on Windows, which meant that while Roslyn could be used to compile code on Unix, the result would not contain any debug information—this prevented Roslyn from being useful for most compilation uses,” he wrote.
The Mono Project is still working to enable full support for PPDB files and by association Roslyn in the ecosystem. According to de Icaza, Mono’s Reflection.Emit implementation requires a back end to generate PPDBs for third-party compilers and dynamic code generators and PPDB support in the IKVM Java Mono implementation. The Mono team is also in the process of fixing class library bugs caused by integrating Roslyn by replacing bits of Mono code with Microsoft .NET reference code.
As of yet there is no set date for completing Roslyn integration as Mono’s default compiler.