System.TypeLoadException: 'VTable setup of type Xamarin.Forms.Forms+AndroidPlatformServices failed'
Asked Answered
N

3

6

I am new to Xamarin and currently I have to make some change to one of the existing application . But When i try to load the projects , initially there were lots of error related to version code.I somehow managed to overcome those error but i got struck to this error .

System.TypeLoadException: 'VTable setup of type Xamarin.Forms.Forms+AndroidPlatformServices failed'enter image description here

Firstly I believed this error might be related to Xamarin Form version no .But I have tried that one too but no luck.In Error log I can see

Severity Code Description Project File Line Suppression State Error NU5048 The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl IniFileParser C:\Program Files\dotnet\sdk\3.1.300\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets 198

Any help will be appreciated .

Nardoo answered 18/6, 2020 at 10:18 Comment(7)
Do you use the FFImageLoading when you get the issue? Have you test a new project? Does it throw the same error?Channelize
I haven't checked for FFImageLoading . I will check this out .Nardoo
Any update for this problem?Channelize
I run into the issues, too. When I use packages.config, the app starts fine.Ventilation
@WendyZang-MSFT No , I am not using FFImageloading.Nardoo
@MiniChip Have you check with the new project? Does it throw the same error? If no, check the code. If it ispossible, could you provide the code which cause the error?Channelize
for me the issue was gone today. try delete bin/obj/.vs folders or clone a new working copyVentilation
P
5

When I get the following type of error:

VTable setup of Type ??? failed.

I've found that the cause is multiple versions of the same dlls, such that version compiled against is different to the version deployed.

If you look at VSs (Debug) Output window, you will likely see errors like (When running with Debugging):

"Could not resolve type with token 0100015a from typeref"

This can be caused by upgrading one of your projects to depend on a newer version of a library and neglecting to do that for all you projects.

To fix, Find the type mentioned next to Could not resolve type with token 0100015a from typeref message, and ensure all references to it's containing dll are of the same version.

Playreader answered 21/4, 2021 at 21:10 Comment(0)
D
1

I solved this by the following:

  1. Go to: Help > Check for Updates
  2. Installed the latest update
  3. Went to: Build > Rebuild Solution

After that I was able to run the debugger on the Android emulator and the error was gone.

Dross answered 3/1, 2022 at 21:12 Comment(0)
U
0

Upgrade Xamarin.Google.Android.Material and Xamarin.AndroidX.AppCompat packagaes to the latest version. It helped me.

Unimposing answered 7/6, 2021 at 23:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.