I am working on extending number of supported platforms for my app, it used to support .NET4/Windows Store/Windows Phone, but I hope to also cover Mono for Android and iOS. I've put all business logic, models and view models to portable class libraries (PCL) but it's a big dilemma what subset of platforms I should target. Each combination causes something to fail. Here are the results for 4 platforms that I might use:
Profile 78 (NET45+WP8+Store): no problem with TPL,await/async and support for CallerMemberName attribute (used in BindableBase view model base class). But the Mono.Android project that refers such library fails to build complaining about non-present System.Runtime.dll that should be referenced.
Profile 104 (NET45+SL4+WP75+Store): await/async don't work, CallerMember name not found, but if I remove all references to them, Android project builds fine.
Profile 147 (NET403+SL5+WP8+Store): await/async don't work, CallerMember name not found, but if I remove all references to them, Android project builds fine.
Profile 158 (NET45+SL5+WP8+Store): await/async don't work, CallerMember name not found, but if I remove all references to them, Android project builds fine.
So I am not really sure what to choose. Profiles 78, 104, 147 are limited, profile 78 is the only one that supports both await/async and CallerMemberName used BindableBase, but it fails on Android complaining about System.Runtime.dll. So if you have an experience with what PCL profile is the best match for PCL targeting Mono, please share your thoughts.
Thinking about profile numbers is hard - I prefer to think in terms of the platforms.
Ideally I'd love my projects to support:
The main PCL project I support is MvvmCross - which requires Mvvm 'facilities' like ICommand. These facilities are only available in platforms for .Net 4.5 and higher... that's a hard limit - nothing I can do about it - so changes my needs to:
With this selection in place, then this leads me to a profile number - 104 (no idea how the platform decided this... gave up asking a long time ago!)
So I've targeted MvvmCross at profile 104 - and it will stay there while WP7.x support is still needed.
This selection does mean that MvvmCross cannot out-of-the-box support things like async
/await
and CallerMemberName
- but this is a compromise we've decided to make - we have users who need WP7.
However, some people are asking about await/async...
To use these new features, there are some BCL.Async Nuget hacks to make them work in profile 104... or these users can target their apps at a newer profile (one that doesn't support WP7.x and SL4) - this leads them to build their apps in profile 78, but to add references to my profile 104 assemblies.
Neither of these sets of solutions works very well with the Xamarin twins at present - e.g. you hit issues like the missing System.Runtime.dll assembly. However, I anticipate that when Xamarin officially supports PCLs (and after some alpha/beta testing) then these problems will be resolved. This official support is due very soon now - which is why I don't bother expending too much of my time thinking about these problems...
I expect in the medium term that MvvmCross will drop support for WP7.x and SL4. When that happens, we may also move the core libraries to profile 78.
The only other large platform I know that has started PCL support is ReactiveUI. I believe this platform must use profile 78 because the PCL version of Reactive from Microsoft is targeting 78.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With