Skip to content

IL2026, IL3000 on ReflectionTestDataCollector #3238

@AArnott

Description

@AArnott

My first TUnit test experiment produces two linker warnings with (the latest) version 0.61.58, as follows:

git clone https://github.com/AArnott/Nerdbank.MessagePack
cd Nerdbank.MessagePack
git checkout tunit
dotnet publish .\test\Nerdbank.MessagePack.TUnit\

  Nerdbank.MessagePack.TUnit succeeded with 5 warning(s) (17.0s) → bin\Nerdbank.MessagePack.TUnit\Debug\net9.0\win-x64\publish\
    e:\.nuget\packages\tunit.core\0.61.58\lib\net9.0\TUnit.Core.dll : warning IL2104: Assembly 'TUnit.Core' produced trim warnings. For more information see https://aka.ms/il2104
    ILC : Trim analysis warning IL2026: TUnit.Engine.Framework.TUnitServiceProvider.TUnitServiceProvider(IExtension,ExecuteRequestContext,ITestExecutionFilter,IMessageBus,IServiceProvider,ITestFrameworkCapabilities): Using member 'TUnit.Engine.Discovery.ReflectionTestDataCollector.ReflectionTestDataCollector()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Reflection-based test discovery requires unreferenced code.
    e:\.nuget\packages\tunit.engine\0.61.58\lib\net9.0\TUnit.Engine.dll : warning IL3053: Assembly 'TUnit.Engine' produced AOT analysis warnings.
    ILC : warning IL3000: TUnit.Engine.Discovery.ReflectionTestDataCollector.ShouldScanAssembly(Assembly): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.
    e:\.nuget\packages\tunit.engine\0.61.58\lib\net9.0\TUnit.Engine.dll : warning IL2104: Assembly 'TUnit.Engine' produced trim warnings. For more information see https://aka.ms/il2104

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions