Skip to content

[area-Tools-ILLink]: Trimmer warnings crash the build #129562

@smoogipoo

Description

@smoogipoo

Description

Hi!

We're migrating our iOS project from .NET 8 to .NET 10 and we're seeing a lot of trimmer warnings. Of course we should aim to get this down to 0, but our projects work with .NET 8 so we're hoping this to be a simple upgrade for now. However, we're encountering an error when building the project:

ILLink : error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink
    Fatal error in IL Linker
    Unhandled exception. System.InvalidOperationException: Sequence contains no elements
       at System.Linq.ThrowHelper.ThrowNoElementsException()
       at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
       at Mono.Linker.MessageOrigin.ToString()
       at Mono.Linker.MessageContainer.ToMSBuildString()
       at Mono.Linker.LinkContext.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.FlushCachedWarnings()
       at Mono.Linker.Steps.ProcessWarningsStep.Process()
       at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
       at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
       at Mono.Linker.Pipeline.Process(LinkContext context)
       at Mono.Linker.Driver.Run(ILogger customLogger)
       at Mono.Linker.Driver.Main(String[] args)
    /Users/smgi/.nuget/packages/microsoft.net.illink.tasks/10.0.8/build/Microsoft.NET.ILLink.targets(103,5): error NETSDK1144: Optimizing assemblies for size failed.

It looks like one of the warning messages are breaking the process.

Reproduction Steps

  1. Clone + checkout smoogipoo/osu@1a3eb1c.
  2. Go into the osu.iOS subdirectory.
  3. dotnet workload restore + dotnet build.

Expected behavior

The build to pass, albeit with warnings.

Actual behavior

The build fails with the exception above.

Regression?

This build previously worked in .NET 8.

Known Workarounds

Compiling with /p:SuppressTrimAnalysisWarnings=true fixes the issue.

Configuration

$ dotnet --info
.NET SDK:
 Version:           10.0.300
 Commit:            caa81fa497
 Workload version:  10.0.301.1
 MSBuild version:   18.6.3+caa81fa49

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  26.3
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /Users/smgi/.dotnet/sdk/10.0.300/

.NET workloads installed:
 [ios]
   Installation Source: SDK 10.0.300
   Manifest Version:    26.5.10284/10.0.100
   Manifest Path:       /Users/smgi/.dotnet/sdk-manifests/10.0.100/microsoft.net.sdk.ios/26.5.10284/WorkloadManifest.json
   Install Type:        FileBased

Configured to use workload sets when installing new manifests.

Host:
  Version:      10.0.8
  Architecture: arm64
  Commit:       94ea82652c

.NET SDKs installed:
  8.0.421 [/Users/smgi/.dotnet/sdk]
  10.0.300 [/Users/smgi/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.27 [/Users/smgi/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.8 [/Users/smgi/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.27 [/Users/smgi/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.8 [/Users/smgi/.dotnet/shared/Microsoft.NETCore.App]

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions