I'm starting a new master xamarin page for testing purposes and updated the nuget packages for the xamarin.android.support and xamarin.forms version. Afterwards, my program gets the exception:
The LoadApplication gets the exception error:
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
Unhandled Exception:
System.TypeLoadException: Could not load type of field 'Xamarin.Forms.Platform.Android.RendererPool:_freeRenderers' (0) due to: Could not resolve type with token 01000275 from typeref (expected class 'System.Collections.Generic.Stack`1' in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e') assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Collections.Generic.Stack`1 member:(null) occurred
Downgrade xamarin.forms and xamarin.forms.maps to v4.1.0.778454 in all projects.
I did it and worked perfectly
The issue is tracked on github and the issue only triggers only Visual Studio 2017 users. If you compile the app with Visual Studio 2019, the app runs fine with Xamarin.Forms 4.2.0.815419 (4.2.0 Service Release 2).
This is caused by a Mono change that made it into Xamarin.Android in VS2019.
System.Collections.Generic.Queue is available in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
and
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
It's not available in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
So if any dll that relies on Queue is complied with VS2019, and run on
VS2017, it will throw exception can't load Queue from mscorlib.
The Xamarin.Forms team tries now to implement Stack and Queue internally in XF code for VS 2017 Compatibility.
Until this is merged, the last Xamarin.Forms bit are compiled with VS2017 and work so fine with VS2017.
Splash screen causing the crash. following answer fixed my issue with latest xamarin forms(4.2.0.815419) and in VS 2019 Ent (16.3.1)
check here