Skip to content

Cannot AOT compile trimmed FSharp.Core #116811

Open
@kerams

Description

@kerams

Apple platform

iOS

Framework version

net10.0-*

Affected platform version

VS 17.14.5, 10.0.100-preview.5.25277.114, 18.4.10622-net10-p5

Description

Similar to dotnet/macios#14813

AOT builds fail when copyused trimming is enabled for FSharp.Core.

1>... Microsoft.iOS.Sdk.net10.0_18.4\18.4.10622-net10-p5\targets\Xamarin.Shared.Sdk.targets(1284,3): error : Failed to AOT compile aot-instances.dll, the AOT compiler exited with code 1.
1>... Microsoft.iOS.Sdk.net10.0_18.4\18.4.10622-net10-p5\targets\Xamarin.Shared.Sdk.targets(1284,3): error : Failed to AOT compile FSharp.Core.dll, the AOT compiler exited with code 1.

Steps to Reproduce

https://github.com/kerams/fsharp-ios-aot

There are 2 lines that use F# types in App.axaml.cs.

Try to compile in Release, see errors. Then remove TrimMode copyused and uncomment IsTrimmable in Theme.iOS.csproj. Complile successfully.

Did you find any workaround?

Disable trimming for FSharp.Core completely with

<ManagedAssemblyToLink Condition="'%(Filename)' == 'FSharp.Core'">
  <IsTrimmable>false</IsTrimmable>
</ManagedAssemblyToLink>

Build logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzers

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions