Updating Nuget caused Exception Unhandled: System.TypeLoadException

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

An unhandled exception of type 'System.TypeLoadException' · Issue , System.TypeLoadException was unhandled Message: An unhandled [Content] A problem caused the program to stop working correctly. VisualStudio 1.0 Pex NuGet Package Manager 3.0.0 NuGet Package Manager in Visual Studio. I submitted a bug report to Telerik, and I'll update my Microsoft bug  Debuging I see the exception is: System.TypeLoadException was unhandled Message: An unhandled exception of type 'System.TypeLoadException' occurred in Microsoft.CodeAnalysis.dll Additional information: Could not load type 'Microsoft.CodeAnalysis.ArrayBuilder`1' from assembly 'Microsoft.CodeAnalysis.VisualBasic, Version=1.0.0.0, Culture=neutral

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.

[Bug] Android app crashes since updating to Xamarin , Since updating to 4.2.0.815419 I now get the following exception thrown at -​nuget-caused-exception-unhandled-system-typeloadexception. > sudo apt-get install nuget > nuget update -self > nuget Unhandled Exception: System.TypeLoadException: Could not load type 'System.AppContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

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

System.TypeLoadException: Could not resolve type with token , Unhandled Exception: System.TypeLoadException: Could not resolve type After some inspectations, I found out that this bug is caused from  Hello there, using the Json.net downloaded from NuGet isn't working for me. I have download the dll's and Add the Reference manually. No luck. I have create a folder in the Core project, add the dll, then reference to there. No luck. Always get the same exception:

[Bug] Android app crashes since updating to Xamarin , TypeLoadException: Could not load type of field 'Xamarin. .com/questions/​58032635/updating-nuget-caused-exception-unhandled-system-​typeloadexception. Unhandled Exception: System.TypeInitializationException: The type initializer for 'Emgu.CV.MatInvoke' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The specified module or one of its dependencies could

TypeLoadException Class (System), The Message property contains more detailed information that can help you identify the cause of the exception. TypeLoadException uses the HRESULT  Since updating to 4.2.0.815419 I now get the following exception thrown at LoadApplication(new App(dbPath, builder)); within MainActivity.cs I did also try v4.3.0.819712-pre2 in case there was a fix contained.

umbraco 703 is totally broken after fresh nuget install, Updating Nuget caused Exception Unhandled: System.TypeLoadException TypeLoadException: Could not load type of field 'Xamarin.Forms. Now the latest Net framework is 4.6. It's almost always is a good idea to use the latest version, cause MS provides a lot of bugfixes and innovations in those. Your customer's environment is .Net framework 4.0. If, in your system, there is a limitation for 4.0, I'm afraid you need to use that one, cause you need to "make the stuff work". So the

Comments
  • Upgraded only to downgrade back. It works though. Thanks. Any other solutions available for this issue?
  • Xamarin.Forms and Xamarin.Forms.Maps both at version 4.2.0.778463 worked for me while the "latest stable" 4.2.0.815419 does not.
  • Can confirm: latest 'stable' 4.2.0.815419 did exactly the same thing for me. Downgrading to the version mentioned above (tho I'm not using maps) fixed the problem. So much for "stable". I thought they'd sorted this kind of problem out now.
  • this really helped thanks. I just wonder how the visual studio version can affect this, as apparently it works in VS 2019, see stackoverflow.com/a/58064929/6923440