Search code examples
mvvmcross

Exception using MvvmCross Messenger Plugin


I'm trying to add the MvvmCross messenger plugin to my droid app following instructions in n+1 9. When I try and run the app on a device the app breaks on an exception.

I removed all my messaging code and can replicate the error just by using nuget to add the messaging plugin to the code and droid apps.

MvvmCross version is 3.1.1

The best I can get to an exception is this stack trace:

0x21 in System.Diagnostics.Debugger.Mono_UnhandledException_internal C# 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException C# 0x26 in object.05a7cd43-7112-4099-a9f9-fc4b0db4842b C# 0x1 in Cirrious.MvvmCross.Platform.MvxSetup.InitializeIoC C# 0x41 in Cirrious.MvvmCross.Platform.MvxSetup.InitializePrimary C# 0x4F in Cirrious.MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.InitializeFromSplashScreen C# 0x14 in Cirrious.MvvmCross.Droid.Views.MvxSplashScreenActivity.OnCreate C# 0x13 in Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.1-branch/d23a19bf/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:1943 C# 0x17 in object.05a7cd43-7112-4099-a9f9-fc4b0db4842b C#

Update

Even if I remove the Messenger plugin I still get the issue. Installing messenger updates MvvmCross from 3.0.14 to 3.1.1 and this is the cause of the error. Don't know why yet though.

Update 2

I rolled everything back to 3.0.14 then used NuGet to update all mvvmcross packages. I then installed messenger and everything seems to work OK.

Looks like adding a 3.1.1 plugin when 3.0.14 is installed can do a bad partial upgrade.


Solution

  • If you want to add a plugin and its version is higher than the core MvvmCross version, use NuGet to upgrade all MvvmCross packages before adding the plugin.