Xamarin project using Prism project template - initial project (with nothing added) builds and runs fine for Android 7.1 emulator. Add Realm NuGet package and the app builds and deploys, but crashes on launch with the following:
Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
This might be due to an invalid debug installation.
A common cause is to 'adb install' the app directly instead of doing from the IDE.
This seems to be a fairly common problem encountered when using Entity Framework and there are a few posts on the internet on it, but I have not found any posts where it occurred due to adding the Realm package. I have tried the suggested solutions that I have come across - use Packages.config rather than PackageReference (I was anyway), change linker option to 'Sdk and User assemblies', add <NoWarn>$(NoWarn);NU1605</NoWarn>
to Android.csproj file, add <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.3.0" />
to csproj file - none of these have made any difference at all.
Anybody come across this, solved it, or have any suggestions? It has stopped me dead in my tracks.