-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[android] trimmer warning for System.Private.CoreLib.dll
#100256
Labels
area-Tools-ILLink
.NET linker development as well as trimming analyzers
linkable-framework
Issues associated with delivering a linker friendly framework
Comments
This is happening here (.NET 9 Preview 3) as well: dotnet/android#8838 |
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Mar 27, 2024
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Mar 27, 2024
dalexsoto
added a commit
to xamarin/xamarin-macios
that referenced
this issue
Mar 28, 2024
dalexsoto
added a commit
to xamarin/xamarin-macios
that referenced
this issue
Mar 28, 2024
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Mar 28, 2024
Changes: dotnet/installer@0752378...09d6f38 Changes: dotnet/runtime@596a1f7...9e6ba1f Changes: dotnet/emsdk@a5f4de7...cf04702 Changes: dotnet/cecil@ba53c75...896cafe Updates: * Microsoft.Dotnet.Sdk.Internal: from 9.0.100-preview.3.24175.18 to 9.0.100-preview.3.24175.24 * Microsoft.NETCore.App.Ref: from 9.0.0-preview.3.24162.31 to 9.0.0-preview.3.24172.9 * Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-preview.3.24156.3 to 9.0.0-preview.3.24171.4 * Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.3.24162.31 to 9.0.0-preview.3.24172.9 * Microsoft.DotNet.Cecil: from 0.11.4-alpha.24158.1 to 0.11.4-alpha.24161.3 Other changes: * [tests] set `$(TrimmerSingleWarn)` to false This allows us to get more information, in the case of new trimmer warnings. * Default `$(_AndroidIncludeSystemGlobalizationNative)` to true Prevents runtime crash: 03-25 19:42:25.386 8502 8502 W Mono : DllImport unable to load library 'libSystem.Globalization.Native'. 03-25 19:42:25.409 8502 8502 W : Process terminated. * Update `.apkdesc` files for `libSystem.Globalization.Native.so` * FIXME: dotnet/runtime#100256 Various tests have the trimmer warning: 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 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). For now, we can assert there are 4 warnings (one per RID). When this is fixed in the future, we can go back to asserting 0 warnings. Co-authored-by: Jonathan Peppers <[email protected]>
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Mar 28, 2024
Changes: dotnet/installer@b40c445...dc43d36 Changes: dotnet/runtime@596a1f7...17f8138 Changes: dotnet/emsdk@a5f4de7...5dd0620 Changes: dotnet/cecil@ba53c75...9c8ea96 Updates: * Microsoft.Dotnet.Sdk.Internal: from 9.0.100-preview.3.24165.20 to 9.0.100-preview.4.24175.5 * Microsoft.NETCore.App.Ref: from 9.0.0-preview.3.24162.31 to 9.0.0-preview.4.24173.6 * Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-preview.3.24156.3 to 9.0.0-preview.3.24160.1 * Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.3.24162.31 to 9.0.0-preview.4.24173.6 * Microsoft.DotNet.Cecil: from 0.11.4-alpha.24158.1 to 0.11.4-alpha.24168.1 Other changes: * [tests] set `$(TrimmerSingleWarn)` to false This allows us to get more information, in the case of new trimmer warnings. * Default `$(_AndroidIncludeSystemGlobalizationNative)` to true Prevents runtime crash: 03-25 19:42:25.386 8502 8502 W Mono : DllImport unable to load library 'libSystem.Globalization.Native'. 03-25 19:42:25.409 8502 8502 W : Process terminated. * Update `.apkdesc` files for `libSystem.Globalization.Native.so` * FIXME: dotnet/runtime#100256 Various tests have the trimmer warning: 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 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). For now, we can assert there are 4 warnings (one per RID). When this is fixed in the future, we can go back to asserting 0 warnings. Co-authored-by: Jonathan Peppers <[email protected]>
sbomer
added a commit
that referenced
this issue
Mar 28, 2024
…100263) Under AggressiveAttributeTrimming setting. Fixes #100256. AggressiveAttributeTrimming was attempting to remove RequiresDynamicCode attributes, but the type was still referenced by FeatureGuardAttribute on IsDynamicCodeCompiled. Adding FeatureGuardAttribute to the set of attributes that get removed with AggressiveAttributeTrimming fixes this. Also adding FeatureSwitchDefinitionAttribute because that one can be removed as well.
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Apr 8, 2024
jonathanpeppers
added a commit
to dotnet/android
that referenced
this issue
Apr 9, 2024
Changes: dotnet/installer@dc43d36...0bfd2dd Changes: dotnet/runtime@17f8138...ffb2578 Changes: dotnet/emsdk@5dd0620...bd79d3d Updates: * Microsoft.Dotnet.Sdk.Internal: from 9.0.100-preview.4.24175.5 to 9.0.100-preview.4.24208.2 * Microsoft.NETCore.App.Ref: from 9.0.0-preview.4.24173.6 to 9.0.0-preview.4.24204.3 * Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-preview.3.24160.1 to 9.0.0-preview.4.24201.2 * Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.4.24173.6 to 9.0.0-preview.4.24204.3 Other changes: * [tests] we can assert 0 trimmer warnings again This is fixed: dotnet/runtime#100256 Co-authored-by: Jonathan Peppers <[email protected]>
matouskozak
pushed a commit
to matouskozak/runtime
that referenced
this issue
Apr 30, 2024
…otnet#100263) Under AggressiveAttributeTrimming setting. Fixes dotnet#100256. AggressiveAttributeTrimming was attempting to remove RequiresDynamicCode attributes, but the type was still referenced by FeatureGuardAttribute on IsDynamicCodeCompiled. Adding FeatureGuardAttribute to the set of attributes that get removed with AggressiveAttributeTrimming fixes this. Also adding FeatureSwitchDefinitionAttribute because that one can be removed as well.
Ruihan-Yin
pushed a commit
to Ruihan-Yin/runtime
that referenced
this issue
May 30, 2024
…otnet#100263) Under AggressiveAttributeTrimming setting. Fixes dotnet#100256. AggressiveAttributeTrimming was attempting to remove RequiresDynamicCode attributes, but the type was still referenced by FeatureGuardAttribute on IsDynamicCodeCompiled. Adding FeatureGuardAttribute to the set of attributes that get removed with AggressiveAttributeTrimming fixes this. Also adding FeatureSwitchDefinitionAttribute because that one can be removed as well.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-Tools-ILLink
.NET linker development as well as trimming analyzers
linkable-framework
Issues associated with delivering a linker friendly framework
Description
This appeared here:
-p:TrimmerSingleWarn=false
yields additional information: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
The text was updated successfully, but these errors were encountered: