我的android应用程序在生产环境中崩溃,我们的崩溃报告工具是xamarinsights,它会转储以下堆栈

at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.GetIoCParameterValues (System.Type type, System.Reflection.ConstructorInfo firstConstructor) [0x00066] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.IoCConstruct (System.Type type) [0x0002a] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.Mvx.IocConstruct[T] () [0x00005] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.Mvx+<>c__13`2[TInterface,TType].<LazyConstructAndRegisterSingleton>b__13_0 () [0x00000] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer+<>c__DisplayClass33_0`1[TInterface].<RegisterSingleton>b__0 () [0x00000] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer+ConstructingSingletonResolver.Resolve () [0x00028] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.InternalTryResolve (System.Type type, MvvmCross.Platform.IoC.MvxSimpleIoCContainer+IResolver resolver, System.Object& resolved) [0x00041] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.InternalTryResolve (System.Type type, System.Nullable`1[T] requiredResolverType, System.Object& resolved) [0x0002e] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.InternalTryResolve (System.Type type, System.Object& resolved) [0x00000] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve (System.Type t) [0x00011] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve[T] () [0x00000] in <4ddde23419c5494288c799fcdbb0f189>:0
at MvvmCross.Platform.Mvx.Resolve[TService] () [0x00005] in <4ddde23419c5494288c799fcdbb0f189>:0
at MyNamespace.Android.PushNotificationListener.SendNotification (System.String message, MyNamespace.Core.NotificationPayload payload) [0x00137] in <03e2d64cacc54ebebbfb6133dd9c33ae>:0

我认为在尝试解析和构造mainthreaddispatcher时引发了异常。但我不明白为什么。
    private IMvxMainThreadDispatcher _dispatcher = Mvx.Resolve<IMvxMainThreadDispatcher>();

    private void ShowToastMessage(string message, double duration)
    {
            _dispatcher.RequestMainThreadAction(() =>
            {
                ...
            });
    }

最佳答案

尝试在每次收到推送时初始化mvvmcross系统,因为可以在不同的上下文中执行(卸载应用程序时),但推送通知服务处于活动状态。
MvvmCross initialization

关于c# - 创建时无法解析IMvxMainThreadDispatcher类型的参数分派(dispatch)器的参数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42528840/

10-11 20:09