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

Unable to publish AOT compiled net9.0-ios apps #3808

Open
jamescrosswell opened this issue Dec 2, 2024 · 2 comments · May be fixed by #3841
Open

Unable to publish AOT compiled net9.0-ios apps #3808

jamescrosswell opened this issue Dec 2, 2024 · 2 comments · May be fixed by #3841
Labels
AOT Bug Something isn't working Platform: iOS
Milestone

Comments

@jamescrosswell
Copy link
Collaborator

When trying to publish the Sentry.Samples.Maui app to a physical device:

dotnet publish /t:Run -f net9.0-ios18.0 /p:_DeviceName=<Device_ID>

AOT compilation fails with a cryptic error. Adding the following properties gives us a bit more detail:

  <PropertyGroup>
    <SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
    <TrimmerSingleWarn>false</TrimmerSingleWarn>
  </PropertyGroup>

The error is then:

  Sentry.Samples.Maui net9.0-ios18.0 failed with 2 error(s) (30.1s) → bin/Release/net9.0-ios18.0/ios-arm64/Sentry.Samples.Maui.dll
    /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/EnumConverterFactory.cs(33): AOT analysis error IL3050: System.Text.Json.Serialization.Converters.EnumConverterFactory.CreateConverter(Type,JsonSerializerOptions): Using member 'System.Text.Json.Serialization.Converters.EnumConverterFactory.Create(Type,EnumConverterOptions,JsonNamingPolicy,JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
    /Users/jamescrosswell/.nuget/packages/microsoft.dotnet.ilcompiler/9.0.0/build/Microsoft.NETCore.Native.targets(317,5): error MSB3073: The command ""/Users/jamescrosswell/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/9.0.0/tools/ilc" @"obj/Release/net9.0-ios18.0/ios-arm64/native/Sentry.Samples.Maui.ilc.rsp"" exited with code -1.

It's still somewhat cryptic as we don't use the EnumConverterFactory anywhere directly, that I can tell.

Needs investigation.

@bricefriha
Copy link
Contributor

It's still somewhat cryptic as we don't use the EnumConverterFactory anywhere directly, that I can tell.

While we don't call it directly in the code, it looks like we do when we compile. 🤔

A similar issue was reported there dotnet/runtime#109177
and solved with this PR: dotnet/runtime#109180

Then, the fix was released as part of .net9.0.
That's the weirdest part. Since this error only popped up after the .net 9 update

@jamescrosswell
Copy link
Collaborator Author

Then, the fix was released as part of .net9.0.

Ah, there's actually a comment about a regression in net9.0:

Might need to add a sample app, as the analyzers won't help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT Bug Something isn't working Platform: iOS
Projects
Status: No status
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants