-1

I am facing the following error on my Xamarin.Forms app.

Interpreter.TryInterpretAndUnwrapContainerException (DryIoc.IResolverContext r, FastExpressionCompiler.LightExpression.Expression expr, System.Boolean useFec, System.Object& result)
System.NullReferenceException: Object reference not set to an instance of an object

Interpreter.TryInterpretAndUnwrapContainerException (DryIoc.IResolverContext r, FastExpressionCompiler.LightExpression.Expression expr, System.Boolean useFec, System.Object& result)
Container.ResolveAndCacheKeyed (System.Int32 serviceTypeHash, System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Object scopeName, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args)
IResolver.Resolve (System.Type serviceType, System.Object serviceKey, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, DryIoc.Request preResolveParent, System.Object[] args)
Resolver.Resolve (DryIoc.IResolver resolver, System.Type serviceType, System.Object[] args, DryIoc.IfUnresolved ifUnresolved, System.Type requiredServiceType, System.Object serviceKey)
DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters)
DryIocContainerExtension.Resolve (System.Type type, System.ValueTuple`2[System.Type,System.Object][] parameters)
PrismApplicationBase.<ConfigureViewModelLocator>b__19_0 (System.Object view, System.Type type)
ViewModelLocationProvider.AutoWireViewModelChanged (System.Object view, System.Action`2[T1,T2] setDataContextCallback)
ViewModelLocator.OnAutowireViewModelChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue)
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)
ViewModelLocator.SetAutowireViewModel (Xamarin.Forms.BindableObject bindable, System.Nullable`1[T] value)
PageUtilities.SetAutowireViewModel (Xamarin.Forms.VisualElement element)
PageNavigationService.CreatePageFromSegment (System.String segment)
PageNavigationService.ProcessNavigationForRootPage (System.String nextSegment, System.Collections.Generic.Queue`1[T] segments, Prism.Navigation.INavigationParameters parameters, System.Nullable`1[T] useModalNavigation, System.Boolean animated)
PageNavigationService.ProcessNavigation (Xamarin.Forms.Page currentPage, System.Collections.Generic.Queue`1[T] segments, Prism.Navigation.INavigationParameters parameters, System.Nullable`1[T] useModalNavigation, System.Boolean animated)
App.OnInitialized ()
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state)

What is interesting, based on AppCenter crashes, it only happens on Huawei devices with Android 9 or 10. I am wondering if anyone has any clue/tip what is going wrong?

System info

  • Xamarin.Forms 5.0.0.2125
  • Prism 8.1.97
  • Prism.DryIoc.Forms 8.1.97
Palle Due
  • 5,929
  • 4
  • 17
  • 32
lawiluk
  • 577
  • 4
  • 13
  • What is the actual exception message or inner exception message? I see only a stack trace. – dadhi May 18 '22 at 14:12
  • 1
    It crashes with lovely NullReferenceException. Unfortunately. as stated above, this is coming from AppCenter and I don't know much more... – lawiluk May 19 '22 at 07:25

1 Answers1

0

The NRE does not provide a lot of info :-( Also, this Prism version uses the old DryIoc version, which complicates the investigation.

As of Today, in principle, you may fork the Prism.DryIoc.Forms, update it to the latest DryIoc v5.0.2 (but instead of DryIoc.dll package use the DryIoc source package). Then reference the Prism directly in your project and put the breakpoint in TryInterpretAndUnwrapContainerException. Check the comment under this answer https://stackoverflow.com/a/72258242/2492669.

I will be interested to find out the real cause of this issue as well.

dadhi
  • 4,807
  • 19
  • 25
  • If you have no Huawei at hand for testing, you can manually report information that might be interesting to AppCenter instead of the break point. – Haukinger May 20 '22 at 09:33