Skip to content

[android] trimmer warning for System.Private.CoreLib.dll #100256

@jonathanpeppers

Description

@jonathanpeppers

Description

This appeared here:

dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.android-x86\9.0.0-preview.4.24173.6\runtimes\android-x86\native\System.Private.CoreLib.dll : warning IL2104: Assembly 'System.Private.CoreLib' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries 

-p:TrimmerSingleWarn=false yields additional information:

ILLink warning IL2045: System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled: Attribute 'System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances).

Reproduction Steps

  • dotnet new android
  • dotnet build -c Release

Add -p:TrimmerSingleWarn=false to get a more detailed warning.

Expected behavior

No trimmer warnings.

Actual behavior

Trimmer warning about System.Private.CoreLib.dll.

Regression?

Yes

Known Workarounds

I suppose you could set -p:SuppressTrimAnalysisWarnings=true, but that is not ideal.

Configuration

.NET SDK: 9.0.100-preview.4.24175.5
.NET Runtime 9.0.0-preview.4.24173.6: 596a1f7...17f8138

Other information

Build logs: android-trimmer.zip

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzerslinkable-frameworkIssues associated with delivering a linker friendly framework

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions