MonoTouch/MonoAndroid builds don't work right


The issue is that the builds of Nito.AsyncEx that get put into the \lib\MonoTouch and lib\Monoandroid are regular .NET dlls and not Monotouch/Monoandroid dlls.

MonoTouch dll's reference System.dll version but reflector shows those libraries referencing 4.0.

The PCL versions work fine with Xamarin's new PCL support; it's the platform-specific enlightenments that don't.

This was ignored in Xamarin.iOS 1.8, but the dependency chain became more strict in 1.10 beta. Trying to use regular .NET Dll's as MonoTouch ones causes Xamarin to pull in the Microsoft System.dll instead of using the Monotouch one. As you might imagine, the Microsoft system.dll won't work on iOS :)

The libraries for Monotouch/Monoandroid need to either be PCL's or actually compiled against Monotouch/Monoandroid. Looking at the checked in source code, I don't see any Xamarin-specific projects for any of the libraries. I can tell by looking at the Import targets - they're all the Microsoft CSharp ones, not the MT/MA ones. Those would be $(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets

The quick fix for this is to update the NuGet package and remove the MonoTouch and MonoAndroid folders. Xamarin will use the PCL's with the default enlightenments. This should be done ASAP as a quick fix.

Then, when you have time, you can create a MonoAndroid and MonoTouch csproj for the enlightenments. They can likely be entirely file-linked as those profiles match .NET 4.5.

Closed Sep 5, 2014 at 1:59 AM by StephenCleary


StephenCleary wrote Dec 15, 2013 at 1:56 AM

Thank you so much for the detailed description!

Yes, the enlightenment dlls were changed in AsyncEx 2.1 to be platform-specific, in order to cleanly support the new Task wrapper for WaitHandles. In AsyncEx 2.0, they were PCLs.

onovotny wrote Dec 15, 2013 at 2:31 AM

Hi Stephen,

Platform specific is good; they just need "real" MonoTouch/Monoandroid project types and not .NET dlls :)

StephenCleary wrote Dec 15, 2013 at 2:46 AM

OK, should be fixed now. MonoTouch/MonoAndroid enlightenments are now PCLs again, which means AsyncFactory.FromWaitHandle will use reflection but the other enlightenments will work fine.

Eventually, these should be MT/MD dlls.

onovotny wrote Dec 15, 2013 at 12:36 PM

Awesome, thanks for the fast turnaround :)