问题
I'm not sure what to do about this. Any suggestions?
Deployment Exception
D/Mono (12535): Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'.
F/monodroid-assembly(12535): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
F/monodroid-assembly(12535): This might be due to an invalid debug installation.
F/monodroid-assembly(12535): A common cause is to 'adb install' the app directly instead of doing from the IDE.
Repro
Visual Studio 2017 (Version 15.5.7)
1) Create a new Cross-Platform App (Xamarin.Forms)
2) Pick Blank App, uncheck iOS, Windows but leave Android checked.
3) Pick Xamarin.Forms and .NET Standard
4) Run this without doing anything more from Visual Studio to an Android 7.x phone or Emulator (such as, Android_Accelerated_Nougat (Android 7.1 - API 25))
See: It deploys and runs just fine
5) Add Microsoft.EntityFramework.Core v2.0.1 from NuGet to the NET Standard project.
6) Run this without doing anything more using the same deployment target.
See: The Deployment Exception
I've also tried updating to the newest Xamarin NuGets but it doesn't affect the result.
I also tried these ideas https://developercommunity.visualstudio.com/content/problem/152947/xamarin-android-run-error-could-not-load-assembly.html
The most promising answer says we need to roll back to package.config but I don't know how to do that in this latest version of Visual Studio.
What is responsible for this bug? EF Core or Xamarin?
来源:https://stackoverflow.com/questions/48956433/ef-core-2-0-1-unsafe-in-xamarin-android