[mono-android] .NET 4.0 + library's
Jonathan Pryor
jpryor at novell.com
Wed Mar 23 09:36:37 EDT 2011
On Mar 23, 2011, at 8:32 AM, Remco Jansen wrote:
> I got a simple question, because cant find the answerers on the internet.
> Is .NET framework 4.0 supported, are there any often uses library's, that are not supported?
That's not specific enough. :-)
The class libraries that Mono for Android provides is...interesting. Succinctly, it's a .NET 4.0-influenced assembly set with an overlapping set of Silverlight types and members, lacking the UI bits. (Which likely doesn't help at all.)
Instead of asking about framework versions, you should instead ask about types (and possibly assemblies). :-)
For example, the Action<...> and Func<...> family of delegate types are supported, up through Action`16 and Func`17, which is what .NET 4.0 and Silverlight support.
However, the IEnumerable<T> interfaces are not covariant, and thus is like Silverlight. The C# compiler we provide on OSX is C#4-ish (it supports generic variance declarations, but no `dynamic`, and generic variance isn't entirely helpful when most of the class library is lacking support...).
Assemblies are .NET 4.0-like, not Silverlight-like, so the System.Net namespace is in System.dll (not System.Net.dll). System.Xml.dll contains XmlDocument and System.Xml.Linq.dll contains XDocument, like .NET 4.0 (while Silverlight drops XmlDocument and moves XDocument into System.Xml.dll).
In short, there isn't really a short way to answer your question, except "maybe." You can also view the class library documentation, which lists all of the namespaces and types provided:
http://docs.mono-android.net/
http://mono-android.net/Documentation/Assemblies
A related question is whether Portable Library Projects are supported. I don't know; I haven't tested them. They are not a priority for 1.0, but we will support them in a later release.
Finally, are there any assemblies that aren't supported? Regarding framework assemblies, it again depends upon what your reference is: with respect to .NET 4.0, we're missing Windows Worfklow and Windows Presentation Foundation (among others, I 'm sure), and the WCF we provide is Silverlight-like, not .NET 4.0-like. If your reference is Silverlight, we're missing System.WIndows.dll and anything related to it.
This variance makes it ~impossible to say whether any existing assemblies will work with Mono for Android without recompilation (unless they're MonoTouch assemblies; those should work). In all likelihood they won't (especially considering assembly naming + assembly versioning), but it should be fairly straightforward to recompile the code against the Mono for Android assemblies, and we fully expect recompilation to work for most things except UI code (which likely won't work at all).
- Jon
More information about the Monodroid
mailing list