Skip to content
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

AOT+LLVM crashes starting with iOS 18_8303 workloads / Xcode 16 #21604

Open
alexanderdibenedetto opened this issue Nov 12, 2024 · 6 comments
Open
Labels
need-info Waiting for more information before the bug can be investigated
Milestone

Comments

@alexanderdibenedetto
Copy link

alexanderdibenedetto commented Nov 12, 2024

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

8.0.401, iOS 18_8303 workloads

Description

When building then running a .NET MAUI 8 project after updating to Xcode 16 / iOS 18_8303 workloads (and confirming the latest workloads released today for iOS has the same issue), the app crashes on start with an "Address size fault". Many libraries seem to face issues using LLVM after updating to XCode 16 / compatible workloads; the previous version using Xcode 15.4 worked without issue using LLVM.

Steps to Reproduce

  1. File > New Project
  2. Add libraries like System.Web.HttpUtility, System.Text.Json, etc (it affects dozens of libraries that I tested)
  3. Add to CSPROJ:
    <MtouchUseLlvm>true</MtouchUseLlvm>
    <MtouchLink>SdkOnly</MtouchLink>
    <Optimize>true</Optimize>
    <MtouchInterpreter>-all</MtouchInterpreter>
    
  4. Observe a crash on app launch (see attached)
    crash-ios18-8303.log

Did you find any workaround?

You must downgrade to Xcode 15.4 / last supported workloads for 15.4 in order to use AOT, OR disable AOT (no LLVM, all instead of -all). I tried finding libraries one by one that cause the crash and stopped after finding over 30 that cause crashes on launch - I'm not excluding a massive list one by one.

For performance reasons, it is incredibly important to not be forced into not aoting any libraries.

Relevant logs

No response

@alexanderdibenedetto
Copy link
Author

Here's a list of all the ones I found published by Microsoft alone that can have this issue:

System.Web.HttpUtility,System.Threading,System.Threading.Channels,System.Text.RegularExpressions,System.Text.Json,System.Text.Encodings.Web,System.Security.Cryptography,System.Security.Claims,System.Runtime.Serialization.Primitives,System.Runtime.Numerics,System.Private.Xml,System.Private.Uri,System.ObjectModel,System.Net.WebProxy,System.Net.WebHeaderCollection,System.Net.Sockets,System.Net.ServicePoint,System.Net.Security,System.Net.Requests,System.Net.NetworkInformation,System.Net.NameResolution,System.Net.Mail,System.Net.Http,System.Net.Http.Json,System.Memory,System.Linq,System.Linq.Expressions,System.IO.Compression,System.Drawing.Primitives,System.Diagnostics.TraceSource,System.Diagnostics.Process,System.Diagnostics.DiagnosticSource,System.Console,System.ComponentModel,System.ComponentModel.TypeConverter,System.ComponentModel.Primitives,System.Collections,System.Collections.Specialized,System.Collections.NonGeneric,System.Collections.Immutable,System.Collections.Concurrent,Microsoft.CSharp

@alexanderdibenedetto alexanderdibenedetto changed the title AOT crashes starting with iOS 18_8303 workloads / Xcode 16 AOT+LLVM crashes starting with iOS 18_8303 workloads / Xcode 16 Nov 12, 2024
@rolfbjarne
Copy link
Member

I'm not able to reproduce this; could you attach a complete test project I can use?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Nov 13, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Nov 13, 2024
@alexanderdibenedetto
Copy link
Author

@rolfbjarne here you go! thank you for all your help btw - I've always appreciated your responsiveness on this repository. If you deploy Release to iOS you can reproduce the crash. I should have mentioned you need to actually make use of one of the affected libraries; I've chosen the Microsoft.Extensions.Resilience library as the example. I used your tip about stripping symbols on another question in order to see that it is the same issue.
llvmCrashDemo.zip

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Nov 14, 2024
@rolfbjarne
Copy link
Member

That project works for me when I run from the command line like this:

dotnet build -t:Run /p:Configuration=Release /p:RuntimeIdentifiers=ios-arm64 /p:_DeviceName="Rolf's iPhone 15"

Are you using VS or VS Code?

@alexanderdibenedetto
Copy link
Author

alexanderdibenedetto commented Nov 18, 2024

Can you try again with this project? llvmCrashDemo.zip

I added another new line for creating an HttpClient that reproduces well with:

 dotnet publish -c Release -f net8.0-ios ./llvmCrashDemo/llvmCrashDemo.csproj

I then upload with apple configuration 2 to remove any reliance on .NET tools that may cause issues.

@rolfbjarne
Copy link
Member

This is rather puzzling, I still can't reproduce, and I did it the exact same you do.

Have you seen this on more than one device (if you have more than one device available)?

Also could you attach (or host on a file-sharing service like Dropbox, since it might be too big) the .ipa you installed on your device using Apple Configurator?

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated no-auto-reply For internal use and removed need-attention An issue requires our attention/response labels Nov 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-info Waiting for more information before the bug can be investigated
Projects
None yet
Development

No branches or pull requests

2 participants