1
votes

System.TypeLoadException'Could not resolve type with token 01000016 from typeref (expected class 'Xamarin.Forms.Xaml.Diagnostics.VisualDiagnostics' in assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null')'

this is the App.cs File where this error appears :

namespace NewApp

{

    public partial class App : Application

    {

        public App()

        {

            InitializeComponent(); // GETTING THE ERROR
            Material.Init(this);
            MainPage = new MaterialNavigationPage(new MainPage());

        }
    }
}
3
This usually happens after an upgrade and/or if your versions are not aligned between the different projects. Make sure that all the Xamarin.Forms versions are the same across projects and clean and rebuild your solution. You might want to delete all bin & obj folders from all projects to be sure.Gerald Versluis
Thanks man .. i tried and deleted all bin & obj couple times then the magic happened @GeraldVersluisKrm Rmdan
In a new project with the same code, does this error occure? If yes, could you provide the code sample which reproduces the error for us to test?Wendy Zang - MSFT
no it doesn't accure on a new project @WendyZang-MSFTKrm Rmdan
I am glad you have solved the problem.Wendy Zang - MSFT

3 Answers

12
votes

I had the same issue when I added the NUGET package Xamarin.Forms.

Check your Android Xamarin.Forms NuGet Package and the same for your IOS project.

You will notice your versions are not matching.

Right click update on each package to update to the latest version.

Do this for all including the Xamarin main project. Then delete the bin and obj folder for each project in your file system. Xamarin, IOS and Android.

Rebuild. Then launch. Should work for you as well.

1
votes

Same thing happened to me during an upgrade of Xamarin.Forms.

The issue seemed to have only been isolated to the iOS build.

To fix this issue, remove the Xamarin.Forms dependency from all the projects in the solution and reinstall Xamarin.Forms through nuget.

Then Clean All --> Rebuild All

0
votes

I had same problem.

Just check if the Xamarin packages are the same version in /Packages, and /Dependencies/NuGet folders.

After that, Clean All and Rebuild All.