question

Oregon39-5606 avatar image
0 Votes"
Oregon39-5606 asked JessieZhang-2116 commented

Xamarin Forms (Android) Target of an Invocation Error with Prism

I'm working on Android in Xamarin Forms, and I'm experiencing an issue with navigating to a SupportView page. It navigates fine in UWP and iOS but in Android it hits the InitializeComponent() in the SupportView code behind and doesn't respond. We are using Prism.

Below are the error message and the stack trace:

An unexpected error occurred while resolving 'JCX.ViewModels.SupportViewViewModel'

at Prism.Unity.UnityContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters) [0x00054] in d:\a\1\s\src\Containers\Prism.Unity.Shared\UnityContainerExtension.cs:295
at Prism.PrismApplicationBase.<ConfigureViewModelLocator>b__22_0 (System.Object view, System.Type type) [0x00070] in d:\a\1\s\src\Forms\Prism.Forms\PrismApplicationBase.cs:118
at Prism.Mvvm.ViewModelLocationProvider.AutoWireViewModelChanged (System.Object view, System.Action`2[T1,T2] setDataContextCallback) [0x0003a] in d:\a\1\s\src\Prism.Core\Mvvm\ViewModelLocationProvider.cs:107
at Prism.Mvvm.ViewModelLocator.OnAutowireViewModelChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00019] in d:\a\1\s\src\Forms\Prism.Forms\Mvvm\ViewModelLocator.cs:70
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:311
at JCX.Views.JCSystem.SupportView.InitializeComponent () [0x00056] in C:\Users\paula\Documents\JCX\JCX\JCX\obj\Debug\netstandard2.0\Views\System\SupportView.xaml.g.cs:38
at JCX.Views.JCSystem.SupportView..ctor () [0x00009] in C:\Users\paula\Documents\JCX\JCX\JCX\Views\System\SupportView.xaml.cs:18


Resolution failed with error: Exception has been thrown by the target of an invocation.

For more detailed information run Unity in debug mode: new UnityContainer().AddExtension(new Diagnostic())

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Oregon39-5606 , just based on the log of your post, it is different for us to reproduce this problem. Could you please post a basic demo to github or onedriver so that we can try to reproduce this problem on our side?

1 Vote 1 ·

1 Answer

Oregon39-5606 avatar image
0 Votes"
Oregon39-5606 answered JessieZhang-2116 commented

@JessieZhang-2116 Thanks so much for your response.

I resolved this issue. The solution was to downgrade the Prism.Unity.Forms package from 8.0.01740-pre to 7.2,0,14222 and have it match the same version as the package in the shared code.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Congrats, and thanks for your support for xamarin.

0 Votes 0 ·