Bug 59110 - Xamarin.iOS ans Xamarin.Android needs the ability to target specific versions of the BCL
Summary: Xamarin.iOS ans Xamarin.Android needs the ability to target specific versions...
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 10.14 (d15-4)
Hardware: PC Windows
: Normal enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-08-30 13:16 UTC by Jerome Laban
Modified: 2017-10-12 19:26 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 59110 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Jerome Laban 2017-08-30 13:16:41 UTC
As of today, Xamarin.iOS only exists as a Xamarin.iOS10, regardless of the installed version of the underlying mono BCL version.

This creates situations where new APIs are added (e.g. Dictionary<>.GetValueOrDefault or Array.Empty<T>() that were added recently) where that can create backward compatibility issues. Compiling a library using the latest VS might produce code that may not be valid using a previous version of Xamarin. Previous versions of Xamarin are very often used in the context of build servers, and/or for long standing applications where updating to the latest Xamarin build may not make sense (particularly VS2015 vs. VS2017).

Both Xamarin.iOS and Xamarin.Android have this issue, and there should be a way to include in the TargetFramework the mono version that was used to build an assembly, and the Xamarin installer should provide a way to install the different framework versions, the same way netcore and netfx are published today.
Comment 1 Marek Safar 2017-08-30 21:58:57 UTC
I can imagine this to be an issue for libraries only. However if you are writing general purpose library we already suggest to target/use netstandard which has targetable API.
Comment 2 Jerome Laban 2017-08-31 13:22:17 UTC
@marek This is a library only issue indeed. 

The libraries I'm talking about are iOS and Android specific libraries, netstandard does not apply in this context.
Comment 3 Marek Safar 2017-08-31 13:52:43 UTC
Why do you think netstandard does not apply in this context? You can achieve what you asked for by targeting netstandard
Comment 4 Jerome Laban 2017-08-31 14:50:40 UTC
The libraries I'm developing explicitly use iOS and Android APIs, therefore those cannot be built using netstandard.
Comment 5 Jerome Laban 2017-10-12 19:26:05 UTC
Yet another case of flip/flop for APIs being added moved: https://github.com/mono/corefx/blob/master/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs#L9 in reaction to this thread: https://github.com/xamarin/xamarin-android/pull/631#issuecomment-321092650

The presence of the method on Dictionary<K,V> was breaking binary compatibility for code that references a later version of Xamarin, and now, this creates a compilation break because two extension methods with the same signature fail with an ambiguous match.

Allowing for specific framework versions would again greatly help.