BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Xamarin Introduces C# Async for iOS and Android

by Jonathan Allen on Mar 12, 2013 |

Xamarin has released a preview of their async-enabled libraries for iOS and Android development. This work is based heavily on Microsoft’s .NET 4.5, which was released late last year as part of Visual Studio 2012. Xamarin is the new name for the development platforms previously known as MonoTouch and Mono for Android.

As part of the Xamarin 2.0 initiative, the mobile platforms have adopted the class libraries found in Mono and .NET. Previously MonoTouch and Mono for Android were restricted to a subset based on Silverlight/Moonlight. Rodrigo Kumpera writes,

While asynchronicity is the main theme of this release, we also pack two years of improvements to the Mono runtime spread over more than 7,000 individual commits that are now available to Android, Mac and iOS users.

This release also brings with it improvements to the iOS batch compiler. Unlike most other platforms, iOS doesn’t allow for JIT-compiled code. This has led to problems with dynamically invoked code, especially where generics are involved.

On iOS we now generate “shareable code” for value types, a truly revolutionary innovation in code generation technology. In practical terms this means that a whole range of code that previously crashed with a “Attempting to JIT compile method” now works. While we still provide the high-performance, and fine-tuned generic code that we can infer –for example direct calls to a method Foo<T>(T x)– we generate a value-type shared version of Foo<T>(T x) that can be used in dynamic cases that previously failed. What was once a dream, is now a reality.

Currently Microsoft’s .NET own JIT compiler doesn’t have this capability. While it will share one method for all reference-types, a generic method has to be re-compiled for each distinct value type.

Variance and Contravariance support, introduced in .NET 4.0, has also found its way into the Xamarin platform.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT