Skip to content

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

@jamescrosswell

Description

@jamescrosswell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions