Search code examples
xamarinuwpmvvmcrossxamarin.uwp

MvvmCross - 'could not load plugin assembly for type Sequence.Plugins.InfiniteScroll.PluginLoader'


I recently updated MvvmCross to version 5.0.5. Now it looks like it's not loading a plugin on my Windows 10 UWP app.

This is the exception I'm receiving on start:

MvvmCross.Platform.Exceptions.MvxException: 'could not load plugin assembly for type Sequence.Plugins.InfiniteScroll.PluginLoader'

I installed the plugin via NuGet and I'm using the bootstrap below. When I comment it, the application opens, but it crashes when I load the list, obviously.

using MvvmCross.Platform.Plugins;
using Sequence.Plugins.InfiniteScroll;
namespace Check.UWP.Bootstrap
{
  public class InfiniteScrollPluginBootstrap : MvxPluginBootstrapAction<PluginLoader>
  {

  }
}

Image: Project References

I'm using this InfiniteScroll Plugin:

https://github.com/HBSequence/Sequence.Plugins

Before the update, everything was working well.

And on Android, I have no problem.

Thanks in advance.


Solution

  • This is due to how MvvmCross looks up plugins by assembly name. At some point this has changed and now looks for Uwp and WindowsCommon: https://github.com/MvvmCross/MvvmCross/blob/develop/MvvmCross/Windows/Uwp/Platform/MvxWindowsSetup.cs#L66

    This means the plugin that you are using, which ends with WindowsUWP, will not be automatically picked up. You may want to ask the author to update his plugin to also build against the latest MvvmCross 5.x

    As a workaround to this, you should be able to load the plugin from your Setup.cs file. You can just remove the bootstrap file.

    Just put the following code in your InitializeLastChance override in your Setup.cs file:

    Mvx.RegisterSingleton<IIncrementalCollectionFactory>(new IncrementalCollectionFactory());