Skip to content

net8 regression: cannot build appextensions on iOS without workaround #19037

@enclave-alistair

Description

@enclave-alistair

Steps to Reproduce

  1. Create an iOS app extension (set <IsAppExtension>true</IsAppExtension>).
  2. Add an owning app that loads the app extension.
  3. Build.

Expected Behavior

Build completes ok.

Actual Behavior

Receive a linker error:

ILLink : error IL1034: Root assembly 'Dotnet.Test.NetExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have entry point. [/Volumes/External/git/fabric-test/src/Dotnet.Test.NetExtension/Dotnet.Test.NetExtension.csproj::TargetFramework=net8.0-ios]
/Users/alistairevans/.nuget/packages/microsoft.net.illink.tasks/8.0.0-rc.1.23419.4/build/Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/Volumes/External/git/fabric-test/src/Dotnet.Test.NetExtension/Dotnet.Test.NetExtension.csproj::TargetFramework=net8.0-ios]

I have to add the following Target to the extension project file to make it work:

<Target Name="_FixRootAssembly" AfterTargets="PrepareForILLink">
    <ItemGroup>
        <TrimmerRootAssembly Update="@(TrimmerRootAssembly)" Condition=" '%(TrimmerRootAssembly.RootMode)' == 'EntryPoint' " RootMode="Library" />
    </ItemGroup>
</Target>

This was inspired by what I think is a related issue: dotnet/runtime#123972

Environment

Only building from the command-line right now (no VS on this Mac); as much version information as possible attached.

Version information
dotnet version
8.0.100-rc.1.23463.5

dotnet workload list
Installed Workload Id      Manifest Version                  Installation Source
--------------------------------------------------------------------------------
maui-maccatalyst           8.0.0-rc.1.9171/8.0.100-rc.1      SDK 8.0.100-rc.1   
maui-ios                   8.0.0-rc.1.9171/8.0.100-rc.1      SDK 8.0.100-rc.1

installed packages:

<PackageVersion Include="Microsoft.Maui.Core" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Controls" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Controls.Core" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Controls.Build.Tasks" Version="8.0.0-rc.1.9171" />

<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Controls.Xaml" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Essentials" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Maui.Resizetizer" Version="8.0.0-rc.1.9171" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-rc.1.23419.4" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0-rc.1.23419.4" />

Build Logs

msbuild.binlog.zip

Example Project

Example project where this failure occurs is here: https://github.com/enclave-alistair/dotnet-ios-netextension/tree/without-trimming-workaround

Workaround is applied on main of that repo, the without-trimming-workaround branch fails to build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fixregressionThe issue or pull request is a regression

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions