-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Announcement] Breaking changes in .NET 6 for iOS, tvOS and macOS #13087
Comments
This also means that we should change precedence rules for net6-ios/tvos/macos TFMs as were designed in https://github.com/dotnet/designs/blob/main/accepted/2021/net6.0-tfms/net6.0-tfms.md. /cc @mhutch |
Context: xamarin/xamarin-macios#13087 We've decided to ship breaking changes with .NET 6 for iOS, macOS and tvOS, and as such we won't be compatible with existing TFMs. All binaries will have be recompiled for .NET 6. I've modified compatibility scenarios that involve iOS or Mac Catalyst to use Android instead (because the compatibility rules for Android won't change).
@marek-safar I have a PR for that: dotnet/designs#252 |
If NFloat is missing things, maybe operators should be added to that? What other features need to be added to that to make it work? Not sure if it is going to have a weird scenario next year where half the stuff is xamarin nfloat and the other is dotnet nfloat. |
Can |
This is the time to finally fix the OpenTK issue! |
Thanks for this. To clarify for those unfamiliar with the Xamarin project planning/schedule, where on the .NET 6 shipping schedule does Xamarin "Preview 11" fall? |
@NogginBops I believe this is point 3 in the issue description? |
Yes, it's technically possible to expose Our feeling is that exposing A more complex example would be a matrix of nfloats: with numerous math operations defined on it, and where you might get different behavior whether we implement something in managed code: xamarin-macios/src/CoreGraphics/CGAffineTransform.cs Lines 258 to 262 in 0ede53d
or we P/Invoke into native code: xamarin-macios/src/CoreGraphics/CGAffineTransform.cs Lines 272 to 278 in 0ede53d
|
NFloat was designed that way, so I feel it's unlikely to change: dotnet/runtime#13788
The fact that it was designed to only show up in the interop layer, and not public API, makes me hope that won't happen. Additionally we're moving our |
Correct, that's planned. |
I can't give any specific dates, but Preview 10 will be released around the same time .NET 6 is launched (.NET Conf Nov 9th-11th), so it's the preview after that, and this fall we've been having a new preview every months or so. |
Ok cool. So I guess my last question is: will the |
Does this mean all the APIs are also being moved from usages of
Not strictly true, S4 and up are at least dual-core 64-bit ARM SoC (wiki). Series 3 is still 32-bit, though, and supported. |
Correct |
No, we're not moving any
Yes, any code that currently uses However, if your code just uses
Strictly speaking you're correct. It's a 64-bit CPU, but it runs in a weird 32-bit mode. Applications are basically 32-bit, and as such, we have to treat it as a 32-bit architecture. [1]: unless it happened to be a mistake to not use |
Yes, it is a trade-off. We typically opt for more native .NET look-and-feel than to precisely expose platform corner cases in .NET APIs. It is not unusual to see manual casts from double to nfloat in Xamarin code that is not a native .NET look-and-feel. Do you think it is the right trade-off to make people type these manual casts and keep learning about the special |
In theory you could use WRT Anyway have fun breaking things :-) |
@rolfbjarne Does this mean that OpenTK will have its own registrar, possibly opening up the per-dll-registrar discussion? If so, having a |
No, not in the short term. The per-dll-registrar feature is unrelated to this (and rather unlikely to be completed for a while due to time constraints).
A dll per framework is something we've discussed internally in the past, but there are circular references between Apple's frameworks, which makes the implementation rather non-trivial, and the cost was deemed not worth it (which doesn't mean that it can't be brought up again at some point). |
👍 I thought it was not going to be slotted for net6, but considered asking, since OpenTK being moved elsewhere means it has to receive static registrar support somehow.
Understood, should I file an issue for this? The split doesn't have to be per-framework, merged assemblies that need AppKit/UIKit and those that don't might be a good compromise. |
Yes, that would be great. |
Awesome and I did notice that when looking at the existing surface area. I've opened dotnet/runtime#63801 to track this and left a couple annotations. Notably there were just conversions missing to/from I also called out that we should likely make them inline with |
@rolfbjarne - what does this change imply for SDKs which currently target |
@bgavrilMS that will continue to work as-is, there are no breaking changes if you want to target |
@rolfbjarne - my team owns the identity SDK. We currently target |
@bgavrilMS it's possible to target both at the same time, and ship a single NuGet that supports both. |
I understand that, and we already target android9.0 and android10.0; I was hoping that there will be a guide that shows us what breaking changes there are and how to mitigate them. I am sure many SDKs will require this. |
@bgavrilMS yes, we're working on a document to explain the changes and how to migrate existing code. |
@rolfbjarne, I still have to write tests but dotnet/runtime#64234 implements the necessary surface area and can be pulled down/built locally if you want to do any prototyping. |
@rolfbjarne due to the changes in the type used for handles, I now get this error: #13867 |
Thanks! |
…pServices.NFloat. (#14197) * Remove ObjCRuntime.nfloat (in favor of System.Runtime.InteropServices.NFloat). * Automatically add a reference to the System.Runtime.InteropServices.Internal package, so that developers get the new NFloat API (with operators) we've added post .NET 6 (but don't do this for .NET 7). * Automatically add a global using alias for System.Runtime.InteropServices.NFloat -> nfloat. This is not behind the usual `ImplicitUsings` condition our other implicit usings are, because they're off by default for existing projects, and the main target for the global using alias for nfloat is upgraded projects. * Automatically generate a global using alias (like above) in the generator for all code the generator compiles. * Update xtro entries to reference System.Runtime.InteropServices.NFloat instead of ObjCRuntime.nfloat. * Add a workaround for a hopefully temporary issue with .NET/CoreCLR where the wrong runtime pack is selected otherwise (without the new NFloat API, so nothing works at runtime). Ref: #13087
All the changes we wanted to do have been implemented, so I'm closing this. The upcoming preview 14 will have all these changes. Barring extreme circumstances, we won't be doing any more breaking changes for subsequent preview/rc releases. Regarding nfloat, we were able to add the operators that were missing in |
…pServices.NFloat. (xamarin#14197) * Remove ObjCRuntime.nfloat (in favor of System.Runtime.InteropServices.NFloat). * Automatically add a reference to the System.Runtime.InteropServices.Internal package, so that developers get the new NFloat API (with operators) we've added post .NET 6 (but don't do this for .NET 7). * Automatically add a global using alias for System.Runtime.InteropServices.NFloat -> nfloat. This is not behind the usual `ImplicitUsings` condition our other implicit usings are, because they're off by default for existing projects, and the main target for the global using alias for nfloat is upgraded projects. * Automatically generate a global using alias (like above) in the generator for all code the generator compiles. * Update xtro entries to reference System.Runtime.InteropServices.NFloat instead of ObjCRuntime.nfloat. * Add a workaround for a hopefully temporary issue with .NET/CoreCLR where the wrong runtime pack is selected otherwise (without the new NFloat API, so nothing works at runtime). Ref: xamarin#13087
In order to fully support the new native types in C# (nint, nuint), we’ve unfortunately realized that we can’t keep compatibility with existing code or assemblies built for Xamarin.iOS or Xamarin.Mac.
The consequences are as follows when upgrading a project to .NET 6:
In addition, we’re taking the opportunity to fix a few mistakes we’ve made in the past, that we’ve been unable able to address because they were breaking changes.
These are the main changes:
nint
andnuint
types as defined by C# (they are System.IntPtr and System.UIntPtr under the hood).For the System.nfloat type we’re probably going to keep the type [1], but move it to a different namespace.We also have a list of minor changes we’ve wanted to do for a long time: #5107. We’ll be going through this list and implement the ones that make sense and that we have time to complete.
The first preview with these breaking changes will be Preview 11.
Reference: #10508
Reference: dotnet/designs#252
Reference: NuGet/Home#11338
[1]:
System.Runtime.InteropServices.NFloat is not a good replacement for System.nfloat, because it’s a very basic type intended only for interop scenarios. For instance, it does not have any operators, so code like “NFloat + NFloat” does not compile.The operators were implemented and back ported to .NET 6, so the concerns with System.Runtime.InteropServices.NFloat went away.The text was updated successfully, but these errors were encountered: