-
Notifications
You must be signed in to change notification settings - Fork 514
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
Mac Catalyst: should we have Runtime.Arch? If so, what should it return? #10312
Comments
I am thinking the solution should be between 2.2 and 2.3, 1 is definitely a no go for me, I think it would be useful to tell that we are running in the MacCatalyst context but OTOH we are running on a Device, definitely not a simulator heh My vote would lean to 2.3, MacCatalyst |
A new value, like
and then it's also used inside generated binding code... if (Runtime.Arch == Arch.DEVICE) { but AFAIK it's always (generated) for @rolfbjarne were you planning to change the generated code for Catalyst ? Maybe we could add |
It's easy enough to change the generated code for Catalyst if we wanted to. It shouldn't affect existing binding NuGets for Xamarin.iOS, because those will have to be rebuilt anyway.
We could do something like this: public enum Arch {
DEVICE,
SIMULATOR,
MACCATALYST = SIMULATOR,
} |
and what will happen when we run this natively on a M1 CPU ? |
Unfortunately Arch.SIMULATOR and Arch.DEVICE has been used with different meanings, which comes back and bites us now 😒 As far as I can tell, some call sites will have to be updated no matter which solution we choose. We'll just have to pick the best poison. |
Indeed, the thing is Up to this summer they were based on different architectures so that worked just fine. But it was effectively a case of badly named members (or property).
I'd rather not pick a poison 💀. It's ☢️ waste so let's pretend it does not exists. I suggest we don't add Instead let's start a new road where we:
|
…properly on ARM-based simulators. * Use the Apple-provided TARGET_OS_SIMULATOR define to determine if we're running in a simulator, instead of checking the current architecture. This way we properly detect ARM64-based simulators (and it'll work correctly in the future). * Always set Runtime.Arch = SIMULATOR for Mac Catalyst. The final value for Runtime.Arch for Mac Catalyst is tracked in xamarin#10312, but this is a stop-gap measure to make sure we have the same value between X64 and ARM64 on Mac Catalyst, and until now we've had Runtime.Arch = SIMULATOR for X64, so just go with that for now.
…properly on ARM-based simulators. (#12125) * Use the Apple-provided TARGET_OS_SIMULATOR define to determine if we're running in a simulator, instead of checking the current architecture. This way we properly detect ARM64-based simulators (and it'll work correctly in the future). * Always set Runtime.Arch = SIMULATOR for Mac Catalyst. The final value for Runtime.Arch for Mac Catalyst is tracked in #10312, but this is a stop-gap measure to make sure we have the same value between X64 and ARM64 on Mac Catalyst, and until now we've had Runtime.Arch = SIMULATOR for X64, so just go with that for now.
…properly on ARM-based simulators. (xamarin#12125) * Use the Apple-provided TARGET_OS_SIMULATOR define to determine if we're running in a simulator, instead of checking the current architecture. This way we properly detect ARM64-based simulators (and it'll work correctly in the future). * Always set Runtime.Arch = SIMULATOR for Mac Catalyst. The final value for Runtime.Arch for Mac Catalyst is tracked in xamarin#10312, but this is a stop-gap measure to make sure we have the same value between X64 and ARM64 on Mac Catalyst, and until now we've had Runtime.Arch = SIMULATOR for X64, so just go with that for now.
Downgrading priority since the current solution works (although it's ugly), and we can implement this at a later stage (we're not going to add any breaking changes either now or later anyway). |
Now that we've decided to do breaking changes for .NET 6, and Mac Catalyst binaries won't be compatible with iOS binaries anymore, I think we can reconsider this and just remove the Runtime.Arch API for Mac Catalyst. |
…ixes #10312. (#13562) Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst, because they don't apply for a Mac Catalyst app (which is neither a simulator environment, nor a device environment). This means that code using these APIs will have to be re-evaluated to determine what's the correct behavior for Mac Catalyst. Also update our tests accordingly. Fixes #10312.
Question:
Possibilities:
Con: existing code won't compile / increases binary incompatibility with iOS.
2.1) Simulator
2.2) Device
2.3) A third value (
MacCatalyst
?)Time estimate (for Sebastien's proposal here): 4 weeks
The text was updated successfully, but these errors were encountered: