Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[illink] set
$(TrimmerRemoveSymbols)
by default (#7365)
Fixes: #7302 Context: dotnet/linker#2203 Context: dotnet/runtime#67660 Context: #6598 This partially backports 745214d. Building a `net6.0-android` app in `Release` mode with .NET 7 can fail with many errors like: error XA4215: The Java type `androidx.activity.contextaware.OnContextAvailableListener` is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted. This happens because we end up with multiple assemblies, such as: obj/Release/net6.0-android/android-arm/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-arm64/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-x64/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-x86/linked/Xamarin.AndroidX.Activity.dll To fix this, in addition to this backport to dotnet/runtime/release/6.0: dotnet/runtime#75311 In .NET 7 we opt into `$(TrimmerRemoveSymbols)` by default for `Release` builds. This allows the .NET 7 linker to have stable MVIDs for assemblies for each architecture. Somehow when the linker outputs `.pdb` files, it creates different MVIDs per architecture. There may potentially be a dotnet/linker issue here to look into further. However, this seems to be the best fix for getting .NET 6 projects building under .NET 7 at the moment.
- Loading branch information