Skip to content

MTP produces IL2104 trim warning for test projects that target net8.0 #7153

@AArnott

Description

@AArnott

Describe the bug

When publishing a NativeAOT test project that targets net8.0, I get the following warning-as-error:

/Users/runner/work/Nerdbank.MessagePack/Nerdbank.MessagePack/.nuget/packages/microsoft.testing.platform/2.0.2/lib/net8.0/Microsoft.Testing.Platform.dll : error IL2104: Assembly 'Microsoft.Testing.Platform' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/runner/work/Nerdbank.MessagePack/Nerdbank.MessagePack/test/Nerdbank.MessagePack.TUnit/Nerdbank.MessagePack.TUnit.csproj::TargetFramework=net8.0]

Steps To Reproduce

git clone -b tunit-net8.0 [email protected]:AArnott/Nerdbank.MessagePack.git
cd Nerdbank.MessagePack
./init.ps1
dotnet publish .\test\Nerdbank.MessagePack.TUnit\ -f net8.0

Expected behavior

No warnings.

Actual behavior

A warning is produced:

e:.nuget\packages\microsoft.testing.platform\2.0.2\lib\net8.0\Microsoft.Testing.Platform.dll : warning IL2104: Assembly 'Microsoft.Testing.Platform' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries

Additional context

dotnet --info
.NET SDK:
 Version:           10.0.101
 Commit:            fad253f51b
 Workload version:  10.0.100.1
 MSBuild version:   18.0.6+fad253f51

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26200
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.101\

.NET workloads installed:
 [ios]
   Installation Source: SDK 10.0.100
   Manifest Version:    26.1.10494/10.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.1.10494\WorkloadManifest.json
   Install Type:              Msi

Configured to use workload sets when installing new manifests.

Host:
  Version:      10.0.1
  Architecture: x64
  Commit:       fad253f51b

.NET SDKs installed:
  9.0.205 [C:\Program Files\dotnet\sdk]
  9.0.307 [C:\Program Files\dotnet\sdk]
  9.0.308 [C:\Program Files\dotnet\sdk]
  10.0.100 [C:\Program Files\dotnet\sdk]
  10.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  DOTNET_CLI_DISABLE_PUBLISH_AND_PACK_RELEASE [true]
  DOTNET_SUGGEST_SCRIPT_VERSION            [1.0.2]

global.json file:
  E:\src\nerdbank.messagepack\global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MTPBelongs to the Microsoft.Testing.Platform core library

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions