Repository navigation
Closed
Closed
Copy link
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Area: TrimmingIssues with ILLink or NativeAOT related to trimming.bugComponent does not function as intended.possibly-staleIssues that are potentially no longer relevant.
Description
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.NET 6.0.100
Description
I have a .NET 6 android app.
When using LinkMode=link or PublishTrimmed=false the app builds fine.
When using LinkMode=copyused I get the following exception at build time:
Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.11.117\tools\Xamarin.Android.Common.targets(1375,3): Error XALNS7028 : System.IO.FileNotFoundException: Could not load assembly 'Xamarin.AndroidX.Transition, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.AndroidX.Transition.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 245
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 191
at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/MetadataResolver.cs:line 110
at Mono.Cecil.ModuleDefinition.Resolve(TypeReference type) in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/ModuleDefinition.cs:line 762
at Mono.Cecil.TypeReference.Resolve() in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/TypeReference.cs:line 278
at Java.Interop.Tools.Cecil.TypeDefinitionCache.Resolve(TypeReference typeReference) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionCache.cs:line 20
at Java.Interop.Tools.Cecil.TypeDefinitionRocks.GetTypeAndBaseTypes(TypeDefinition type, IMetadataResolver resolver)+MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs:line 40
at Java.Interop.Tools.Cecil.TypeDefinitionRocks.IsSubclassOf(TypeDefinition type, String typeName, IMetadataResolver resolver) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs:line 94
at MonoDroid.Tuner.FixAbstractMethodsStep.FixAbstractMethods(AssemblyDefinition assembly)
at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 22
The library Xamarin.AndroidX.Transition is being transitively referenced with version 1.4.1.3. Explicitly referencing the assembly leads to the same exception.
I can't say for sure, whether this is an issue with the AndroidX binding or the build task, but I was under the impression that using LinkMode=copyused is the safer trimming mode and so I consider this inconsistency at build time unexpected.
Steps to Reproduce
See description.
Did you find any workaround?
Only not to use LinkMode=copyused.
Relevant log output
See description.Metadata
Metadata
Assignees
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Area: TrimmingIssues with ILLink or NativeAOT related to trimming.bugComponent does not function as intended.possibly-staleIssues that are potentially no longer relevant.
Activity
dotnet-policy-service commentedon Aug 7, 2026
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
dotnet-policy-service commentedon Aug 21, 2026
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.