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...
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: XI 10.14 (d15-4)
Hardware: PC Windows
: Normal enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-30 13:16 UTC by Jerome Laban
Modified: 2017-10-12 19:26 UTC (History)
4 users (show)

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


Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.