dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

[META] Xcode 15.3 Support for .NET 8 and MAUI #21057

Closed jfversluis closed 6 months ago

jfversluis commented 9 months ago

Update: with the release of .NET 8.0.300 the below crashes are resolved and you should be able to use Xcode 15.3 and 15.4.

However, the .NET for iOS team is still working on making the new APIs added in Xcode 15.3+ available. To keep track of that progress, please refer to this issue: https://github.com/xamarin/xamarin-macios/issues/20257


Below text is copied from the .NET for iOS repository (see here). TL;DR Xcode 15.3 is not supported at this time.


Hello!

Xcode 15.3 was released on March 5, 2024. We are in the process of updating our bindings and our infra in order to support this release.

~As of the time of this post, Xcode 15.3 is not recommended to be used with our .NET MAUI or Xamarin SDKs so our advise is not to install it just yet and keep using Xcode 15.2 for the time being.~

See update at the top of this issue.

If you need to download Xcode 15.2 you can get it from the Apple Developer portal.

Known issues

~iOS 17.4 Simulator crashes~

~Workaround: Use Xcode 15.2. If you really need to use Xcode 15.3 then either use iOS Simulator 17.2 or the workaround provided in https://github.com/dotnet/runtime/issues/98941.~


We'll keep this post updated as we learn more.

Thank you!

-The macios team (and .NET MAUI team 😄 )

MitchBomcanhao commented 9 months ago

this is highly necessary - a number of other issues make using 15.3 necessary (can't even debug the iOS app without it), but now it seems that a bunch of bits are entirely broken when using 15.3, in my case mostly around globalization.

stephen-hawley commented 8 months ago

When this is fixed, please update .github/DEVELOPMENT.md so the dev guide doesn't contraindicate Xcode 15.3.

Phenek commented 8 months ago

It should be great to have this informations on the .Net MAUI Output of visual studio code! We already have Android sdk version displayed

Output:

Android components:
    - Java SDK (version: '11.0.22'): installed.

    Android SDK recommended required components:
    - platforms/android-34 (version: '3'): installed.
    - build-tools/34.0.0 (version: '34.0.0'): installed.
    - platform-tools (version: '35.0.1'): installed.
    - cmdline-tools/11.0 (version: '11.0'): installed.

    Android SDK recommended optional components:
    - emulator (version: '34.1.19'): installed.
    - system-images/android-34/google_apis/x86_64 (version: '8'): installed.
    - system-images/android-33/google_apis_playstore/x86_64 (version: '7'): installed.

We could add informations about Xcode/Android sdk compatibilities? Orange or Red flag on versions, should inform us. A link with the current issue to follow on github would be really appreciated!

AOgai commented 8 months ago

Hi,

installing Xcode 15.2 and using the simulator iOS 17.2 works great for debugging and local deployment.

However, uploading the app to the App Store fails the review process:

We were unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.

Review device details:

  • Device type: iPhone 14 Pro
  • OS version: iOS 17.4

So I guess on the App Store they use a simulator with iOS 17.4, which then crashes.

Any help or ideas is appreciated.

Thank you Arnold

AndreKraemer commented 8 months ago

@AOgai, I'm curious, have you attempted to run a release build on your local emulator to see if it also crashes? It's worth investigating because crashes upon app launch often occur in release builds (but not in debug builds) when the interpreter isn't utilized. For further insights, you might want to check out these issues:

AOgai commented 8 months ago

@AOgai, I'm curious, have you attempted to run a release build on your local emulator to see if it also crashes? It's worth investigating because crashes upon app launch often occur in release builds (but not in debug builds) when the interpreter isn't utilized. For further insights, you might want to check out these issues:

@AndreKraemer: Release build on emulator iOS 17.2 works fine.

Release build on emulator iOS 17.4 crashes with following message:

Xamarin-Simulator UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <_UIMoreListTableView: 0x111ae6200; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000c8ae20>; backgroundColor = <UIDynamicSystemColor: 0x600001748f00; name = tableBackgroundColor>; layer = <CALayer: 0x6000005bbc60>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <UIMoreListController: 0x10d42e840>>

The interpreter workarounds didn't work for me.

What worked for me was adding this from Issue 98941:

<PropertyGroup>
    <_LibXamarinLinkMode>static</_LibXamarinLinkMode>
    <_LibMonoLinkMode>static</_LibMonoLinkMode>
</PropertyGroup>
<Target Name="_FixMonoLinkMode" AfterTargets="_MonoReadAvailableComponentsManifest">
    <ItemGroup>
        <_MonoRuntimeComponentLinking Remove="dynamic" />
        <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="ios-arm64" />
        <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="iossimulator-arm64" />
        <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="iossimulator-x64" />
    </ItemGroup>
</Target>

Edit: I think <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="ios-arm64" /> is maybe not needed.

jdarwood007 commented 7 months ago

Edit: I think <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="ios-arm64" /> is maybe not needed.

With that line included I receive the following error when trying to publish:

Value of _MonoRuntimeComponentLinking for 'ios-arm64' must be 'dynamic' or 'static' it is 'static;static'. Malformed runtime pack?

I had to remove that line to get it to publish.

pierre01 commented 7 months ago

Please Fix this ASAP!! Updated: "Actually the fix involving changing the iOS emulator version to 17.2 was easy... and worked well"

JoacimWall commented 7 months ago

Hi Use this one if you want to have multiple version of Xcode or just 2 minutes install instead of 30 minutes.

https://www.xcodes.app

//Joacim

MitchBomcanhao commented 7 months ago

15.4 beta 1 has now been released for a few days. by the time whatever fix is done to get 15.3 supported, 15.4 or 15.5 or who knows which version will already be available and probably also not working.

stemig commented 7 months ago

Unacceptable response times...

malsabi commented 7 months ago

Is there any progress related to this issue ? Our production app does not work in 15.3 and users are complaining it's crashing.

mattlovell commented 7 months ago

I managed to get an App onto testflight after removing all the CSS from the project, which turned out to be the cause of weird xaml errors that would crash the app on device or release testing...... not sure why CSS is no longer valid as worked fine for 6 months...

Oh well only took 1.5 weeks to find the issue and missed a client deadline

imuller commented 7 months ago

@jfversluis Can you give an update when this is available?

jfversluis commented 7 months ago

@imuller subscribe to this issue and when it's closed there probably will be a comment with an update and then it will probably be available as well of have information when it will be!

Richard-Starrtec commented 6 months ago

Do we have an ETA on this?

zacharykeeping commented 6 months ago

Can confirm .NET 8.0.5 fixes this for us.

matouskozak commented 6 months ago

Can confirm .NET 8.0.5 fixes this for us.

Thank you for trying the new servicing release. The .NET 8.0.5 contains the fix for https://github.com/dotnet/runtime/issues/98941, thanks for verifying that it works. This should unblock the Xcode 15.3 support. FYI: @jfversluis

malsabi commented 6 months ago

I updated to .NET 8.0.5 and It's still crashing on 17.4 Simulator but on 15.5 it's working completely fine.

MAUIoxo commented 6 months ago

So, is it already possible to do the update to 15.3 using latest nightly builds, or better still wait?

HansenPeter commented 6 months ago

With Xcode 15.4 now available, can you provide us with an update on this please?

Take-A-Byte commented 6 months ago

Does this affect running apps on android emulators on Mac?

somoreingold commented 6 months ago

Does this affect running apps on android emulators on Mac?

No, this issue is about iOS. I've got nothing but sympathy for the small team at MS working on this, but would love to know some order-of-magnitude timeline as we devs are bound to such timelines to our own bosses. Is it weeks? months? days?

jfversluis commented 6 months ago

With the release of .NET 8.0.300 all should be resolved here and you should be able to use Xcode 15.3 and 15.4 without any issues.

The .NET for iOS team is working on making all new APIs that came with Xcode 15.3+ available. To track the progress, please refer to this issue: https://github.com/xamarin/xamarin-macios/issues/20257

Any issues with this will likely need to be reported to the .NET for iOS repository (see link just above here).

I'm closing this issue here as the most pressing issue, crashing builds, should now be over.

kpespisa commented 6 months ago

I still experience a crash in my MAUI app using Xcode 15.3 or 15.4.

` *** error for object 0x127d3fe64: pointer being freed was not allocated

(62073,0x307ed4000) malloc: *** set a breakpoint in malloc_error_break to debug` Moving back to using Xcode 15.2 avoids the problem. I haven't yet narrowed down what triggers the crash, but it is not occurring at a certain point in my MAUI code - it occurs at various times during startup. I will try to find the source of the issue, probably by removing startup related code, xaml, etc. until it doesn't crash, and will open a new bug if I can get to that point. However, adding this in case anyone else has hit the same mysterious problem.
matouskozak commented 6 months ago

I still experience a crash in my MAUI app using Xcode 15.3 or 15.4.

*** error for object 0x127d3fe64: pointer being freed was not allocated <my_app_name>(62073,0x307ed4000) malloc: *** set a breakpoint in malloc_error_break to debug

Moving back to using Xcode 15.2 avoids the problem.

I haven't yet narrowed down what triggers the crash, but it is not occurring at a certain point in my MAUI code - it occurs at various times during startup.

I will try to find the source of the issue, probably by removing startup related code, xaml, etc. until it doesn't crash, and will open a new bug if I can get to that point. However, adding this in case anyone else has hit the same mysterious problem.

This looks like a similar error to this one, however we would need to see the stack trace to confirm. You can check https://github.com/dotnet/runtime/issues/98941 to see if the stack trace looks similar. If that is the case, I would recommend verifying that your MAUI app is using the 8.0.5 .NET runtime as it might still be using the older version due to caching, etc.