From f42f327310b44ead20b092f51582b2093cc0c833 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 1 Feb 2021 17:27:56 -0800 Subject: [PATCH 01/24] Add initial draft for .NET 6.0 TFMs --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 110 +++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 accepted/2021/net6.0-tfms/net6.0-tfms.md diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md new file mode 100644 index 000000000..c50242500 --- /dev/null +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -0,0 +1,110 @@ +# .NET 6.0 Target Frameworks + +**PM** [Immo Landwerth](https://github.com/terrajobst) + +In [.NET 5.0][net5.0] we defined a new syntax for target frameworks (TFM) that +allows us to avoids tools and humans to use a decoder ring, such as the .NET +Standard version table, to figure out what is compatible with what. In this +document, we're listing which TFMs we're adding in .NET 6.0. + +## Scenarios and User Experience + +TBD + +## Requirements + +### Goals + +* Support the definition of frameworks relevant for Xamarin development + +### Non-Goals + +* Re-design the TFM syntax + +## Stakeholders and Reviewers + +* MSBuild / SDK team +* NuGet team +* Project system team +* Xamarin team + +## Design + +| TFM | Compatible With | +|--------------------|------------------------------------------| +| net6.0 | (subsequent version of net5.0) | +| net6.0-windows | (subsequent version of net5.0-windows) | +| net6.0-android | xamarin.android | +| | (+everything else inherited from net6.0) | +| net6.0-ios | xamarin.ios | +| | (+everything else inherited from net6.0) | +| net6.0-macos | xamarin.mac | +| | (+everything else inherited from net6.0) | +| net6.0-maccatalyst | xamarin.ios | +| | (+everything else inherited from net6.0) | +| net6.0-tvos | xamarin.tvos | +| | (+everything else inherited from net6.0) | +| net6.0-watchos | xamarin.watchos | +| | (+everything else inherited from net6.0) | + +### Compatibility rules + +The [built-in compatibility rules][net5.0] of the `netX.Y-platform` TFMs make a +TFM automatically compatible with: + +1. Itself +2. Earlier versions of itself +3. The corresponding `netX.Y` TFM +4. Earlier versions of the corresponding `netX.Y` TFM + +The `net5.0` TFM has the additional twist that it's compatible with +`netcoreapp3.2` (and earlier), `netstandard2.1` (and earlier) as well as .NET +Framework (`net4.x` and earlier, but under a warning). The .NET Framework +compatibility is achieved as a *fallback*, that is, it's only used when nothing +else applies. + +We don't want to model the Xamarin TFMs as a fallback but instead want them to +apply **before** `netcoreapp` and `netstandard`. Usually the existence of the +Xamarin TFM implementation is to bait a `netstandard` API and switch the +platform specific implementation. Most of the Plugin type packages use this +pattern and in fact the `netstandard` "implementation" is more like a reference +assembly with just stubs that throw at runtime. `Xamarin.Essentials` is a good +example of this. The same rational can be applied to `netcoreapp` where this +would logically be the server implementation (or maybe a .NET Core 3.x desktop +implementation). + +> ***OPEN QUESTION**: Should `net6.0-maccatalyst` also have a compatibility +> relationship with any of the **existing** Xamarin TFMs, such as `xamarin.mac` +> or `xamarin.tvos`?* +> +> ***OPEN QUESTION**: Should `net6.0-maccatalyst` also have a compatibility +> relationship with any of the **new** Xamarin TFMs, such as `net6.0-mac`?* +> +> ***OPEN QUESTION**: Should `net6.0-maccatalyst` generate a warning when assets +> from `xamarin.ios` are being used? + +## Q & A + +### Why didn't we name it `net6.0-macos-catalyst`? + +We didn't want a secondary dash because it implies some relationship with +`net6.0-macos`. Also, in the past we talked about supporting prefix-based +compatibility rules with more levels, using a dash for this new TFM would make +it harder to add support for this later. + +### Why didn't we name it `net6.0-catalyst`? + +Looks like [Apple refers to it as "Mac Catalyst"](https://developer.apple.com/mac-catalyst/). + +### Why did we make `net6.0-maccatalyst` compatible with the existing Xamarin TFMs? + +It's true that for native code existing binaries largely don't work in Mac +Catalyst and that developers are generally expected to recompile. However, the +Xamarin team believes that enough managed code would just work that makes this +compat relationship useful. This follows the principle of the .NET Framework +compatibility mode which is: + +> Instead of blocking things that might not work, unblock things that could +> work. + +[net5.0]: ../../2020/net5/net5.md From c616b420b3907f26615a3238b2d3f713e9a015f6 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Thu, 4 Feb 2021 18:23:42 -0800 Subject: [PATCH 02/24] Address minor feedback on wording --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index c50242500..445481242 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -3,9 +3,9 @@ **PM** [Immo Landwerth](https://github.com/terrajobst) In [.NET 5.0][net5.0] we defined a new syntax for target frameworks (TFM) that -allows us to avoids tools and humans to use a decoder ring, such as the .NET -Standard version table, to figure out what is compatible with what. In this -document, we're listing which TFMs we're adding in .NET 6.0. +makes it unnecessary for both tools and humans to use a decoder ring, such as +the .NET Standard version table, to figure out what is compatible with what. In +this document, we're listing which TFMs we're adding in .NET 6.0. ## Scenarios and User Experience @@ -59,7 +59,7 @@ TFM automatically compatible with: The `net5.0` TFM has the additional twist that it's compatible with `netcoreapp3.2` (and earlier), `netstandard2.1` (and earlier) as well as .NET -Framework (`net4.x` and earlier, but under a warning). The .NET Framework +Framework (`net4x` and earlier, but under a warning). The .NET Framework compatibility is achieved as a *fallback*, that is, it's only used when nothing else applies. From ccf4f1c603477e680a8670c2c72518c142ba2527 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Fri, 5 Feb 2021 13:14:09 -0800 Subject: [PATCH 03/24] Remove watchOS because we scoped this out from .NET 6 --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 445481242..51a8a0290 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -44,8 +44,6 @@ TBD | | (+everything else inherited from net6.0) | | net6.0-tvos | xamarin.tvos | | | (+everything else inherited from net6.0) | -| net6.0-watchos | xamarin.watchos | -| | (+everything else inherited from net6.0) | ### Compatibility rules From 95b11cb5e674d36663e877d379d76de2e0954e93 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Fri, 5 Feb 2021 13:14:43 -0800 Subject: [PATCH 04/24] Resolve open issues --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 51a8a0290..16c083c92 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -71,15 +71,24 @@ example of this. The same rational can be applied to `netcoreapp` where this would logically be the server implementation (or maybe a .NET Core 3.x desktop implementation). -> ***OPEN QUESTION**: Should `net6.0-maccatalyst` also have a compatibility -> relationship with any of the **existing** Xamarin TFMs, such as `xamarin.mac` -> or `xamarin.tvos`?* -> -> ***OPEN QUESTION**: Should `net6.0-maccatalyst` also have a compatibility -> relationship with any of the **new** Xamarin TFMs, such as `net6.0-mac`?* -> -> ***OPEN QUESTION**: Should `net6.0-maccatalyst` generate a warning when assets -> from `xamarin.ios` are being used? +A `net6.0-maccatalyst` project referencing a NuGet package should behave as +follows: + +* It should prefer `xamarin.ios` assets over `netcoreapp` and `netstandard` + assets. + - However, it should still prefer `net5.0`/`net6.0` assets over + `xamarin.ios`. + - It also shouldn't be compatible with any other existing Xamarin TFM (such + as `xamarin.mac`) +* Generate NuGet warning [NU1701] when a `xamarin.ios` asset is being used + - Package 'packageId' was restored using 'xamarin.ios' instead the project + target framework 'net6.0-maccatalyst'. This package may not be fully + compatible with your project. +* Should only use compatible `net5.0` based TFMs, namely `net5.0`, `net6.0`, and + `net6.0-maccatalyst`. + - Specifically, it should not accept `net6.0-ios`. The expectation is that + moving forward libraries that want to work on iOS and Mac Catalyst should + use `net6.0` or multi-target for `net6.0-ios` and `net6.0-maccatalyst` ## Q & A @@ -105,4 +114,11 @@ compatibility mode which is: > Instead of blocking things that might not work, unblock things that could > work. +### Why didn't we make `net6.0-ios` compatible with `net6.0-maccatalyst`? + +The expectation is that moving forward libraries that want to work on iOS and +Mac Catalyst would use `net6.0` or multi-target for `net6.0-ios` and +`net6.0-maccatalyst` + [net5.0]: ../../2020/net5/net5.md +[NU1701]: https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1701 From 665cf78ea7d65762464e309e495568a77a734e13 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Fri, 5 Feb 2021 13:18:37 -0800 Subject: [PATCH 05/24] Add section on APIs and RIDs --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 16c083c92..e5f7cd363 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -90,6 +90,27 @@ follows: moving forward libraries that want to work on iOS and Mac Catalyst should use `net6.0` or multi-target for `net6.0-ios` and `net6.0-maccatalyst` +## APIs + +We need to add platform detection APIs for Mac Catalyst: + +```C# +namespace System +{ + public partial class OperatingSystem + { + public static bool IsMacCatalyst(); + public static bool IsMacCatalystVersionAtLeast(int major, int minor = 0, int build = 0); + } +} +``` + +## RIDs + +We need to add RIDs for all these platforms: + +* TBD + ## Q & A ### Why didn't we name it `net6.0-macos-catalyst`? From 24ee92c3634cbbeac7df2ee32e29fc506c5446e3 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Fri, 5 Feb 2021 13:21:06 -0800 Subject: [PATCH 06/24] Expand on RIDs --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index e5f7cd363..4d55533df 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -109,7 +109,21 @@ namespace System We need to add RIDs for all these platforms: -* TBD +* `net6.0-android` + - TBD +* `net6.0-ios` + - TBD +* `net6.0-maccatalyst` + - `maccatalyst-arm64` + - `maccatalyst-arm64-13` + - `maccatalyst-arm64-14` + - `maccatalyst-x64` + - `maccatalyst-x64-13` + - `maccatalyst-x64-14` +* `net6.0-macos` + - TBD +* `net6.0-tvos` + - TBD ## Q & A From 71100098acca81241680faac793a212a9f4e5b77 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 09:38:48 -0800 Subject: [PATCH 07/24] Include RIDs for Android, macOS, iOS, and tvOS --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 130 ++++++++++++++++++++++- 1 file changed, 126 insertions(+), 4 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 4d55533df..613bc950b 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -110,9 +110,91 @@ namespace System We need to add RIDs for all these platforms: * `net6.0-android` - - TBD + - `android` + - `android-arm` + - `android-arm64` + - `android-x64` + - `android-x86` + - `android.21` + - `android.21-arm` + - `android.21-arm64` + - `android.21-x64` + - `android.21-x86` + - `android.22` + - `android.22-arm` + - `android.22-arm64` + - `android.22-x64` + - `android.22-x86` + - `android.23` + - `android.23-arm` + - `android.23-arm64` + - `android.23-x64` + - `android.23-x86` + - `android.24` + - `android.24-arm` + - `android.24-arm64` + - `android.24-x64` + - `android.24-x86` + - `android.25` + - `android.25-arm` + - `android.25-arm64` + - `android.25-x64` + - `android.25-x86` + - `android.26` + - `android.26-arm` + - `android.26-arm64` + - `android.26-x64` + - `android.26-x86` + - `android.27` + - `android.27-arm` + - `android.27-arm64` + - `android.27-x64` + - `android.27-x86` + - `android.28` + - `android.28-arm` + - `android.28-arm64` + - `android.28-x64` + - `android.28-x86` + - `android.29` + - `android.29-arm` + - `android.29-arm64` + - `android.29-x64` + - `android.29-x86` + - `android.30` + - `android.30-arm` + - `android.30-arm64` + - `android.30-x64` + - `android.30-x86` * `net6.0-ios` - - TBD + - `ios` + - `ios-arm` + - `ios-arm64` + - `ios-x64` + - `ios-x86` + - `ios.8` + - `ios.8-arm` + - `ios.8-arm64` + - `ios.8-x64` + - `ios.8-x86` + - `ios.9` + - `ios.9-arm` + - `ios.9-arm64` + - `ios.9-x64` + - `ios.9-x86` + - `ios.10` + - `ios.10-arm` + - `ios.10-arm64` + - `ios.10-x64` + - `ios.10-x86` + - `ios.11` + - `ios.11-arm64` + - `ios.11-x64` + - `ios.12` + - `ios.12-arm64` + - `ios.12-x64` + - `ios.13` + - `ios.13-arm64` + - `ios.13-x64` * `net6.0-maccatalyst` - `maccatalyst-arm64` - `maccatalyst-arm64-13` @@ -121,9 +203,49 @@ We need to add RIDs for all these platforms: - `maccatalyst-x64-13` - `maccatalyst-x64-14` * `net6.0-macos` - - TBD + - `osx` + - `osx-arm64` + - `osx-x64` + - `osx.10.10` + - `osx.10.10-arm64` + - `osx.10.10-x64` + - `osx.10.11` + - `osx.10.11-arm64` + - `osx.10.11-x64` + - `osx.10.12` + - `osx.10.12-arm64` + - `osx.10.12-x64` + - `osx.10.13` + - `osx.10.13-arm64` + - `osx.10.13-x64` + - `osx.10.14` + - `osx.10.14-arm64` + - `osx.10.14-x64` + - `osx.10.15` + - `osx.10.15-arm64` + - `osx.10.15-x64` + - `osx.10.16` + - `osx.10.16-arm64` + - `osx.10.16-x64` + - `osx.11.0` + - `osx.11.0-arm64` + - `osx.11.0-x64` * `net6.0-tvos` - - TBD + - `tvos` + - `tvos-arm64` + - `tvos-x64` + - `tvos.10` + - `tvos.10-arm64` + - `tvos.10-x64` + - `tvos.11` + - `tvos.11-arm64` + - `tvos.11-x64` + - `tvos.12` + - `tvos.12-arm64` + - `tvos.12-x64` + - `tvos.13` + - `tvos.13-arm64` + - `tvos.13-x64` ## Q & A From beb388e0b9288a58c84efd3e427156ebf45eb875 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 09:46:24 -0800 Subject: [PATCH 08/24] There was no .NET Core 3.2 (ayayyay!) --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 613bc950b..a759cb9fe 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -56,7 +56,7 @@ TFM automatically compatible with: 4. Earlier versions of the corresponding `netX.Y` TFM The `net5.0` TFM has the additional twist that it's compatible with -`netcoreapp3.2` (and earlier), `netstandard2.1` (and earlier) as well as .NET +`netcoreapp3.1` (and earlier), `netstandard2.1` (and earlier) as well as .NET Framework (`net4x` and earlier, but under a warning). The .NET Framework compatibility is achieved as a *fallback*, that is, it's only used when nothing else applies. From 077eabdd0aa7b5bc8887adfbc7660fafd910102e Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 09:48:13 -0800 Subject: [PATCH 09/24] Address Alexander's feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Köplinger --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index a759cb9fe..8e277eba0 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -197,11 +197,11 @@ We need to add RIDs for all these platforms: - `ios.13-x64` * `net6.0-maccatalyst` - `maccatalyst-arm64` - - `maccatalyst-arm64-13` - - `maccatalyst-arm64-14` + - `maccatalyst.13-arm64` + - `maccatalyst.14-arm64` - `maccatalyst-x64` - - `maccatalyst-x64-13` - - `maccatalyst-x64-14` + - `maccatalyst.13-x64` + - `maccatalyst.14-x64` * `net6.0-macos` - `osx` - `osx-arm64` @@ -262,7 +262,7 @@ Looks like [Apple refers to it as "Mac Catalyst"](https://developer.apple.com/ma ### Why did we make `net6.0-maccatalyst` compatible with the existing Xamarin TFMs? -It's true that for native code existing binaries largely don't work in Mac +It's true that for native code existing binaries don't work in Mac Catalyst and that developers are generally expected to recompile. However, the Xamarin team believes that enough managed code would just work that makes this compat relationship useful. This follows the principle of the .NET Framework From d3d7d8cc0b99f42f1b31250a24d8b2107a0573f0 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 10:01:22 -0800 Subject: [PATCH 10/24] Add section for platform annotations --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 8e277eba0..6e375b6e7 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -105,6 +105,29 @@ namespace System } ``` +## Platform support annotations + +It seems the Xamarin team wants to have a single assembly with bindings for the +iOS platforms (e.g. Mac Catalyst and iOS). The APIs should be annotated with +`SupportedOSVersionAttribute` and don't need any `UnsupportedOSVersionAttribute` +(the absence of a platform is interpreted as the platform not being supported). +For instance: + +```C# +public class SomeType +{ + [SupportedOSPlatform("ios8.0")] + [SupportedOSPlatform("maccatalyst13.0")] + public void MethodSupportedOn_iOS_and_Mac_Catalyst(); + + [SupportedOSPlatform("ios8.0")] + public void MethodSupportedOn_iOS_Only(); + + [SupportedOSPlatform("maccatalyst13.0")] + public void MethodSupportedOn_Mac_Catalyst_Only(); +} +``` + ## RIDs We need to add RIDs for all these platforms: From 76d9135801acc8638c0b7d89ec2c587a0fbca00c Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 10:25:20 -0800 Subject: [PATCH 11/24] Clarify merged vs. individual bindings --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 6e375b6e7..6612736af 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -128,6 +128,14 @@ public class SomeType } ``` +However, from a user experience it's irrelevant if the Xamarin team provides the +bindings in separate libraries or in a single library because there is no TFM +that developers can use to build a single binary that can work in both Mac +Catalyst and iOS. A developer either has to target Mac Catalyst (via +`net6.0-maccatalyst`) or iOS (via `net6.0-ios`). Of course, the developer can +multi-target for both but that means two binaries are being produced which means +the Xamarin bindings could also be provided as separate libraries. + ## RIDs We need to add RIDs for all these platforms: From ee14a326d4e57c54c92a5d27dc83b09656e4aabc Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 10:27:11 -0800 Subject: [PATCH 12/24] Add user experience and requirement around Mac Catalyst and Xamarin iOS --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 6612736af..ec28cafa7 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -9,13 +9,30 @@ this document, we're listing which TFMs we're adding in .NET 6.0. ## Scenarios and User Experience -TBD +### Using an existing library in Mac Catalyst + +Sophia is building her an application for Mac Catalyst. From her experience with +Xamarin iOS she knows the library `Xamarin.FFImageLoading` and wants to use it. +The package installs successfully, but upon building she gets the following +warning: + +> Package 'Xamarin.FFImageLoading' was restored using 'xamarin.ios' instead the +> project target framework 'net6.0-maccatalyst'. This package may not be fully +> compatible with your project. + +To find our more, she visit's the packages project site, which is on GitHub. She +decides to file an issue to ask whether the library will add support for Mac +Catalyst, but for the time being she's unblocked and can continue the +development on her app. ## Requirements ### Goals * Support the definition of frameworks relevant for Xamarin development +* Mac Catalyst is able to consume libraries built for Xamarin iOS, even though + the binary might not work. The developer should get a warning, but the tools + shouldn't block it. ### Non-Goals From b953b89ef0e1b55a884546ba1f757973c5999d8b Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 10:43:55 -0800 Subject: [PATCH 13/24] Fix wording --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index ec28cafa7..dce11f03e 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -11,19 +11,19 @@ this document, we're listing which TFMs we're adding in .NET 6.0. ### Using an existing library in Mac Catalyst -Sophia is building her an application for Mac Catalyst. From her experience with +Sophia is building an application for Mac Catalyst. From her experience with Xamarin iOS she knows the library `Xamarin.FFImageLoading` and wants to use it. The package installs successfully, but upon building she gets the following warning: -> Package 'Xamarin.FFImageLoading' was restored using 'xamarin.ios' instead the -> project target framework 'net6.0-maccatalyst'. This package may not be fully -> compatible with your project. +> Package 'Xamarin.FFImageLoading' was restored using 'xamarin.ios' instead of +> the project target framework 'net6.0-maccatalyst'. This package may not be +> fully compatible with your project. -To find our more, she visit's the packages project site, which is on GitHub. She +To find out more, she visits the package's project site, which is on GitHub. She decides to file an issue to ask whether the library will add support for Mac -Catalyst, but for the time being she's unblocked and can continue the -development on her app. +Catalyst, but for the time being she's unblocked and can continue to develop her +app. ## Requirements From ae07c4a263883ab81f4dbf6498fa2ed796ae66b1 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 13:29:10 -0800 Subject: [PATCH 14/24] Clarified annotations for bindings vs BCL APIs --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index dce11f03e..52953e7f0 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -153,6 +153,10 @@ Catalyst and iOS. A developer either has to target Mac Catalyst (via multi-target for both but that means two binaries are being produced which means the Xamarin bindings could also be provided as separate libraries. +This is slightly different for cross-platform BCL APIs. Here we'd follow the +path we took for Blazor WebAssembly and mark APIs that don't work in Xamarin +with attributes like `[UnsupportedOSPlatform("iOS")]. + ## RIDs We need to add RIDs for all these platforms: From 90bcc19fdd2ecbf1e52ef9dd5e3c5159db9ad4f6 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 13:29:43 -0800 Subject: [PATCH 15/24] Add open question based on Frank's feedback --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 52953e7f0..985cce1b8 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -107,6 +107,14 @@ follows: moving forward libraries that want to work on iOS and Mac Catalyst should use `net6.0` or multi-target for `net6.0-ios` and `net6.0-maccatalyst` +> ***OPEN QUESTION** Should `xamarin.ios` take precedence over the new +> cross-platform `net5.0` (and higher) as well? On the one hand, it seems that +> people who upgrade their package for .NET 5+ would also use the new TFMs. On +> the other hand, it doesn't seem unlikely for Xamarin authors to support both +> the new as well as the old TFMs for a while. That might include +> `net5.0`/`net6.0` for bait & switch scenarios, where preferring them over +> `xamarin.ios` would be undesirable. + ## APIs We need to add platform detection APIs for Mac Catalyst: From 13cb28612fef31d80d31be99f7759d74d03fbd2d Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 14:10:05 -0800 Subject: [PATCH 16/24] Fix typo --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 985cce1b8..866852d6c 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -134,9 +134,9 @@ namespace System It seems the Xamarin team wants to have a single assembly with bindings for the iOS platforms (e.g. Mac Catalyst and iOS). The APIs should be annotated with -`SupportedOSVersionAttribute` and don't need any `UnsupportedOSVersionAttribute` -(the absence of a platform is interpreted as the platform not being supported). -For instance: +`SupportedOSPlatformAttribute` and don't need any +`UnsupportedOSPlatformAttribute` (the absence of a platform is interpreted as +the platform not being supported). For instance: ```C# public class SomeType From 589fbc4cf4b7e4d6daaaaa248b5a3aaebf046523 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 14:24:12 -0800 Subject: [PATCH 17/24] Fix API name --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 866852d6c..9cd7fb707 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -134,9 +134,9 @@ namespace System It seems the Xamarin team wants to have a single assembly with bindings for the iOS platforms (e.g. Mac Catalyst and iOS). The APIs should be annotated with -`SupportedOSPlatformAttribute` and don't need any -`UnsupportedOSPlatformAttribute` (the absence of a platform is interpreted as -the platform not being supported). For instance: +`[SupportedOSPlatform]` and don't need any `[UnsupportedOSPlatform]` (the +absence of a platform is interpreted as the platform not being supported). For +instance: ```C# public class SomeType From 1d408485f5e0a848ee2b125a5fa56ed29632c2d8 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 14:23:30 -0800 Subject: [PATCH 18/24] Sort RIDs for Mac Catalyst to match the other platforms --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 9cd7fb707..54b9b5ded 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -257,10 +257,10 @@ We need to add RIDs for all these platforms: - `ios.13-x64` * `net6.0-maccatalyst` - `maccatalyst-arm64` - - `maccatalyst.13-arm64` - - `maccatalyst.14-arm64` - `maccatalyst-x64` + - `maccatalyst.13-arm64` - `maccatalyst.13-x64` + - `maccatalyst.14-arm64` - `maccatalyst.14-x64` * `net6.0-macos` - `osx` From deec01ae134de4c70a048d82d00cd67891965cdf Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 14:23:51 -0800 Subject: [PATCH 19/24] Add iOS 14 and tvOS 14 --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 54b9b5ded..18fa8a00f 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -255,6 +255,9 @@ We need to add RIDs for all these platforms: - `ios.13` - `ios.13-arm64` - `ios.13-x64` + - `ios.14` + - `ios.14-arm64` + - `ios.14-x64` * `net6.0-maccatalyst` - `maccatalyst-arm64` - `maccatalyst-x64` @@ -306,6 +309,9 @@ We need to add RIDs for all these platforms: - `tvos.13` - `tvos.13-arm64` - `tvos.13-x64` + - `tvos.14` + - `tvos.14-arm64` + - `tvos.14-x64` ## Q & A From b199c762ec9c09b5e5ee741f8b6ab9d1d087ab47 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Mon, 8 Feb 2021 20:08:52 -0800 Subject: [PATCH 20/24] Close italics --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 18fa8a00f..75a11d343 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -113,7 +113,7 @@ follows: > the other hand, it doesn't seem unlikely for Xamarin authors to support both > the new as well as the old TFMs for a while. That might include > `net5.0`/`net6.0` for bait & switch scenarios, where preferring them over -> `xamarin.ios` would be undesirable. +> `xamarin.ios` would be undesirable.* ## APIs From 0b22921f8326810abb34cfdef2b8d597c059810d Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Fri, 12 Feb 2021 13:55:24 -0800 Subject: [PATCH 21/24] Clarify how xmarin.ios relates to net5.0 in Mac Catalyst --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 34 +++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 75a11d343..9f1953334 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -91,10 +91,9 @@ implementation). A `net6.0-maccatalyst` project referencing a NuGet package should behave as follows: -* It should prefer `xamarin.ios` assets over `netcoreapp` and `netstandard` - assets. - - However, it should still prefer `net5.0`/`net6.0` assets over - `xamarin.ios`. +* It should prefer `xamarin.ios` assets over `netcoreapp`, `netstandard`, + and `net5.0` assets. + - However, it should still prefer `net6.0` assets over `xamarin.ios`. - It also shouldn't be compatible with any other existing Xamarin TFM (such as `xamarin.mac`) * Generate NuGet warning [NU1701] when a `xamarin.ios` asset is being used @@ -107,14 +106,6 @@ follows: moving forward libraries that want to work on iOS and Mac Catalyst should use `net6.0` or multi-target for `net6.0-ios` and `net6.0-maccatalyst` -> ***OPEN QUESTION** Should `xamarin.ios` take precedence over the new -> cross-platform `net5.0` (and higher) as well? On the one hand, it seems that -> people who upgrade their package for .NET 5+ would also use the new TFMs. On -> the other hand, it doesn't seem unlikely for Xamarin authors to support both -> the new as well as the old TFMs for a while. That might include -> `net5.0`/`net6.0` for bait & switch scenarios, where preferring them over -> `xamarin.ios` would be undesirable.* - ## APIs We need to add platform detection APIs for Mac Catalyst: @@ -337,6 +328,25 @@ compatibility mode which is: > Instead of blocking things that might not work, unblock things that could > work. +### Why did we make `net6.0-maccatalyst` prefer `net6.0` over `xamarin.ios`? + +The intention of making `net6.0-maccatalyst` being able to use `xamarin.ios` is +so that the new platform can use packages that were designed before Mac Catalyst +existed but would have a high chance of working just fine. + +Considering that many Xamarin packages use bait & switch (that is they provide a +cross-platform API but have a Xamarin-specific implementation) it is desirable +that `xamarin.ios` is preferred over `netcoreapp` and `netstandard`. This also +includes `net5.0`, because it is the successor of `netstandard` and existed +before `net6.0-maccatalyst`. + +This rationale doesn't apply for packages that target .NET 6. When they do that, +they are generally not expected to target the old Xamarin TFMs but the new .NET +6 TFMs, such as `net6.0-maccatalyst` and `net6.0-ios`. As such, preferring +`net6.0` over `xamarin.ios` is more sensible. It also avoids ambiguities for +package authors that want to ship assets for the old Xamarin stack and the new +.NET 6-based Xamarin stack. + ### Why didn't we make `net6.0-ios` compatible with `net6.0-maccatalyst`? The expectation is that moving forward libraries that want to work on iOS and From c7aa6065bbca023e450302e39780767d675a5de4 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Tue, 16 Feb 2021 15:44:48 -0800 Subject: [PATCH 22/24] List precedence rules for all new TFMs --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 9f1953334..a933ff661 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -106,6 +106,45 @@ follows: moving forward libraries that want to work on iOS and Mac Catalyst should use `net6.0` or multi-target for `net6.0-ios` and `net6.0-maccatalyst` +We want the same rules for `net6.0-ios` except that using `xamarin.ios` should +not generate a warning. This reasoning results in these precedence rules: + +**net6.0-ios** + +1. `net6.0-ios` +1. `net6.0` +1. `xamarin.ios` (no warning) +1. `net5.0` +1. `netcoreapp3.1` – `1.0` +1. `netstandard2.1` – `1.0` +1. `net4.x` – `1.0` (warning) + +**net6.0-maccatalyst** + +1. `net6.0-ios` +1. `net6.0` +1. `xamarin.ios` ([NU1701] warning) +1. `net5.0` +1. `netcoreapp3.1` – `1.0` +1. `netstandard2.1` – `1.0` +1. `net4.x` – `1.0 ([NU1701] warning) + +**net6.0-macos** + +1. `net6.0-macos` +1. `net6.0` - `5.0` +1. `netcoreapp3.1` – `1.0` +1. `netstandard2.1` – `1.0` +1. `net4.x` – `1.0` ([NU1701] warning) + +**net6.0-tvos** + +1. `net6.0-tvos` +1. `net6.0` - `5.0` +1. `netcoreapp3.1` – `1.0` +1. `netstandard2.1` – `1.0` +1. `net4.x` – `1.0` ([NU1701] warning) + ## APIs We need to add platform detection APIs for Mac Catalyst: From 3cddc29f01ea17ba7c636a1bc0f940599663f771 Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Wed, 17 Feb 2021 11:40:23 -0800 Subject: [PATCH 23/24] Update accepted/2021/net6.0-tfms/net6.0-tfms.md Co-authored-by: Jonathan Dick --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index a933ff661..321017b5b 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -121,7 +121,7 @@ not generate a warning. This reasoning results in these precedence rules: **net6.0-maccatalyst** -1. `net6.0-ios` +1. `net6.0-maccatalyst` 1. `net6.0` 1. `xamarin.ios` ([NU1701] warning) 1. `net5.0` From e9393d454e9618552fcd8185f086afe92b85ec9d Mon Sep 17 00:00:00 2001 From: Immo Landwerth Date: Wed, 17 Feb 2021 17:02:42 -0800 Subject: [PATCH 24/24] Include xamarin.macos and xamarin.tvos in precedence rules --- accepted/2021/net6.0-tfms/net6.0-tfms.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/accepted/2021/net6.0-tfms/net6.0-tfms.md b/accepted/2021/net6.0-tfms/net6.0-tfms.md index 321017b5b..fadf10dff 100644 --- a/accepted/2021/net6.0-tfms/net6.0-tfms.md +++ b/accepted/2021/net6.0-tfms/net6.0-tfms.md @@ -132,7 +132,9 @@ not generate a warning. This reasoning results in these precedence rules: **net6.0-macos** 1. `net6.0-macos` -1. `net6.0` - `5.0` +1. `net6.0` +1. `xamarin.macos` (no warning) +1. `net5.0` 1. `netcoreapp3.1` – `1.0` 1. `netstandard2.1` – `1.0` 1. `net4.x` – `1.0` ([NU1701] warning) @@ -140,7 +142,9 @@ not generate a warning. This reasoning results in these precedence rules: **net6.0-tvos** 1. `net6.0-tvos` -1. `net6.0` - `5.0` +1. `net6.0` +1. `xamarin.tvos` (no warning) +1. `net5.0` 1. `netcoreapp3.1` – `1.0` 1. `netstandard2.1` – `1.0` 1. `net4.x` – `1.0` ([NU1701] warning)