android: ResolveAssemblies task wrongly uses reference assemblies
Steps to Reproduce
- Get and Build repro https://github.com/marcominerva/XamarinAndroidIssue
If you instead the build log you will see that
Using "ResolveAssemblies" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll".
has few ...ref/netstandard2.0/... references which is wrong as they should never be used as an input to linker or any post compilation processing
This issue is possibly related to #1154
Expected Behavior
No error during execution.
Actual Behavior
[Mono] Assembly Loader probing location: ‘System.Memory’. [monodroid-assembly] Could not load assembly ‘System.Memory’ during startup registration.
Version Information
Xamarin.Android Version: 8.1.0.25 (Visual Studio Community) Android SDK: /Users/marek/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 6.0 (API level 23) 7.1 (API level 25)
SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.5 SDK Build Tools Version: 25.0.3
Log File
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1500,2): warning : Ignoring /Users/marek/.nuget/packages/system.buffers/4.4.0/ref/netstandard2.0 as it is a Reference Assembly
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1500,2): warning : Ignoring /Users/marek/.nuget/packages/system.memory/4.4.0-preview2-25405-01/ref/netstandard2.0 as it is a Reference Assembly
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1500,2): warning : Ignoring /Users/marek/.nuget/packages/system.runtime.compilerservices.unsafe/4.4.0/ref/netstandard2.0 as it is a Reference Assembly
VS bug #585873
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (2 by maintainers)
Commits related to this issue
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- Added fix for netstandard/android. See https://github.com/xamarin/xamarin-android/issues/1162#issuecomment-359475008 — committed to DotNetRu/App by pfedotovsky 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- Realm backend (#148) * Removed no longer needed Audit files - will be replaced by single Realm file * Added Realm file * Replaced services to get data from Realm database * Updated NuGet packa... — committed to DotNetRu/App by pfedotovsky 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. Fixes #1154, #1162 Netstandard packages sometimes ship with both reference and implementation assemblies. The Nuget build task... — committed to dellis1972/xamarin-android by dellis1972 9 years ago
- [Xamarin.Android.Build.Tasks] Better support for netstandard libraries. (#1356) Fixes: https://github.com/xamarin/xamarin-android/issues/1154 Fixes: https://github.com/xamarin/xamarin-android/issues/... — committed to dotnet/android by dellis1972 9 years ago
- Release 1.1.0 (#157) * Full screen image of the speaker is shown by tap on the speaker page … (#119) Full screen image of the speaker is shown by tap on the speaker page * Add information about... — committed to DotNetRu/App by pfedotovsky 9 years ago
- Release/1.2.0 (#170) * Full screen image of the speaker is shown by tap on the speaker page … (#119) Full screen image of the speaker is shown by tap on the speaker page * Add information about... — committed to DotNetRu/App by pfedotovsky 8 years ago
- Realm backend (#148) * Removed no longer needed Audit files - will be replaced by single Realm file * Added Realm file * Replaced services to get data from Realm database * Updated NuGet packa... — committed to DotNetRu/App by pfedotovsky 9 years ago
- Added fix for netstandard/android. See https://github.com/xamarin/xamarin-android/issues/1162#issuecomment-359475008 — committed to DotNetRu/App by pfedotovsky 9 years ago
Here’s a functioning workaround. It’s hacky and ugly but works with minimum fuss. Put this in an XML file and
<Import>it in your Android csproj file at the end. It works at least for System.BuffersUpdate: Fixed an issue where if there were no ref assemblies in the list, the
ResolvedAssemblieswould be emptied. Symptoms of that issue: Build failure with cannot findobj\linksrc\SomeAssembly.dllor an assembly not found error. The bug fix was adding a condition to only empty ResolvedAssemblies if ResolvedAssembliesFixed was not empty.Any ETA for a fixed version of Xamarin.Android with these ?
I found another workaround: In my case, the NuGet package “System.Runtime.CompilerServices.Unsafe” caused the issue. So I made a copy of the package (*.nupkg file), removed the “ref”-folder from it (which contains the reference assemblies), and installed that modified package into my project.
Now that the package only contains the “real” assembly, there’s no way for Mono to accidentally pick the wrong assembly.