Skip to content

Trimmer/AOT compiler issues warnings but they are not shown and publish is successful. #95932

@voroninp

Description

@voroninp

Description

I see the following build output when publishing my project:

2>Generating native code
2>"C:\Users\pavel.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\8.0.0\tools\ilc" @"obj\Release\net8.0\win-x64\native\AotWarningsTest.ilc.rsp"
2>Assembly 'Microsoft.Build.Locator' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
2>Assembly 'System.Composition.TypedParts' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
2>Assembly 'Microsoft.CodeAnalysis.Workspaces' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
2>Assembly 'System.Composition.TypedParts' produced AOT analysis warnings.
2>Assembly 'System.Composition.Hosting' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries
2>Assembly 'System.Composition.Hosting' produced AOT analysis warnings.
2>ILC: Method '[S.P.CompilerGenerated]Internal.CompilerGenerated..ReverseDelegateStub__hostfxr_get_available_sdks_result_fn(hostfxr_resolve_sdk2_result_key_t,char**)' will always throw because: Marshaling directives are invalid
2>ILC: Method '[S.P.CompilerGenerated]Internal.CompilerGenerated..ReverseOpenStaticDelegateStub__hostfxr_get_available_sdks_result_fn(hostfxr_resolve_sdk2_result_key_t,char**)' will always throw because: Marshaling directives are invalid
2>ILC: Method '[Microsoft.CodeAnalysis.Workspaces.MSBuild]Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(string,IProgress`1,CancellationToken)' will always throw because: Failed to load assembly 'Microsoft.Build.Framework'
2>ILC: Method '[Microsoft.CodeAnalysis.Workspaces.MSBuild]Microsoft.CodeAnalysis.Host.Mef.MSBuildMefHostServices.CreateDefaultAssemblies()' will always throw because: Failed to load assembly 'Microsoft.Build.Framework'

However, I see neither warnings nor errors in the Error List window. The publishing is also successful.

Reproduction Steps

Here is the repository for the project.
It's the default project created by Standalone Code Analysis template.

https://github.com/voroninp/AotWarningsTest

Expected behavior

I'd expect failure in publish and errors screaming at me.

Actual behavior

Some hardly noticaeble mentions of Trim and AOT warnings.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions