Xamarin.forms: [Bug] Xamarin.Forms 4.1.0 Method not found: void .ResourceLoadingQuery.set_Instance(object)

Created on 5 Jul 2019  ·  15Comments  ·  Source: xamarin/Xamarin.Forms

Description

Type resolution exception from my IoC container when trying to resolve a dependency. The following error is thrown:

Method not found: void .ResourceLoadingQuery.set_Instance(object)

This has not been an issue when using Xamarin Forms 4.0.0.xxxx and has only appeared since an upgrade to 4.1.0.555618

Expected Behavior

Type resolution, no error.

Actual Behavior

Type Resolution exception

Basic Information

  • Version with issue: 4.1.0.555618
  • Last known good version: 4.0.0.425677
  • IDE: VS2019 16.0.4

  • Platform Target Frameworks:

    • Android: 9.0 (Pie)
  • Nuget Packages:
    Xamarin.Forms 4.1.0.555618,
    NETStandard.Library 2.0.3

  • Affected Devices: Samsung S8

Android needs-info ❓ needs-repro ❔ unverified bug

Most helpful comment

@johnallan78 I also faced the same issue void .ResourceLoadingQuery.set_Instance(object) the reason i found out is i had updated Xamarin Forms only in one project, Please make sure that Android and iOS have same latest version as your forms project or shared project.

All 15 comments

Would it be possible for you to create a small sample project that reproduces this behavior?

Also, did you test iOS?

Hi Gerald, thanks for your quick reply. I've checked our iOS build and it works fine with the upgraded Xamarin Forms 4.1.0.555618 package. I'm using VSCommunity version 7.6.9 to build and deploy on iOS, version 12.2.1.11.
It's going to be tricky giving you a repo as I'm using a large IoC library and will have to check that I'm not violating any ISO/company rules before trying to recreate one for the bug. I'll see what I can manage.

Please let us know! If it's not going to work we will see if we can figure something out on our end, but it would be greatly appreciated to speed things up :)

I've had a further look at this and the crash is happening in the InitializeComponent() method in the constructor of the code behind of a XAML template. I'm creating the XAML template in code with a container. To test I stripped all of the XAML out of the template bar the essential namespaces. The template is a ContentPage. The exception is still thrown.

@StephaneDelcroix this looks like something you might know more about?

@johnallan78 I also faced the same issue void .ResourceLoadingQuery.set_Instance(object) the reason i found out is i had updated Xamarin Forms only in one project, Please make sure that Android and iOS have same latest version as your forms project or shared project.

I can confirm @IosDeveloperHarsh solution. i upgraded only on my netstandard project and froget the android

@johnallan78 can you please confirm if this is the case for you as well? And if so, close the issue? Thanks!

Hi @jfversluis, I can confirm that the suggestions from @IosDeveloperHarsh and @AlenToma have solved the problem I had. Thanks everyone.

devenv_hbuMN0upK4

Hello to everyone. My application is running on android. I get this error on iOS. What exactly should I do? Anybody have any ideas?

Have you made sure that all of your projects run the same version of Xamarin.Forms? Please carefully check that each project shared the same version of Forms and rebuild the whole solution

Oh, I thought I checked, but I missed an update. I did the update and the problem was solved. Thank you very much!

I just update all xamarin.forms nuget packages (your android code must have no error!)

To me I had the same issue but I've figured out that in my scenario had mixed some xamarin.forms versions (4.1.xx, 3.6.xx). After upgrading (nuget package for solution...) all to version 4.1xx it works fine.

This can still happen after upgrading/downgrading to a different version of Xamarin.Forms, even if all projects are on the same version, as it seems to cache in the bin/obj folders. Deleting bin/obj folders and full rebuild did the trick for me.

Was this page helpful?
0 / 5 - 0 ratings