Skip to content

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

Closed

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.

Activity

  1. added
    bug
    regression
    on Sep 19, 2023
  2. added this to the .NET 9 milestone on Sep 19, 2023
  3. rolfbjarne commented on Sep 19, 2023

    @rolfbjarne
    Member

    I can reproduce this.

  4. added 2 commits that reference this issue on Sep 19, 2023
    cc08b07
    5f67945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugregression

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions