ReflectionTypeLoadException:无法加载一种或多种请求的类型。检索 LoaderExceptions 属性 以获取 WP 中的更多信息
ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information in WP
运行 WP 项目时出现此错误,但 Android 工作正常。我关注 this link 并尝试了所有选项,但没有成功。它不会在代码端引发错误,只会在输出 window 上显示错误消息,因此无法调试它并且应用程序无法启动。请帮助解决这个问题。
出现此错误:
******************* MVXApp.Initialize
mvx:Diagnostic: 26.16 Setup: ViewModelTypeFinder start
mvx:Diagnostic: 26.17 Setup: ViewsContainer start
mvx:Diagnostic: 26.18 Setup: ViewDispatcher start
mvx:Diagnostic: 26.18 Setup: Views start
Exception thrown: 'System.Reflection.ReflectionTypeLoadException' in mscorlib.ni.dll
mvx:Warning: 26.36 ReflectionTypeLoadException masked during loading of MspManager.App.Phone81, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null - error ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at Cirrious.CrossCore.ReflectionExtensions.GetTypes(Assembly assembly)
at Cirrious.CrossCore.IoC.MvxTypeExtensions.ExceptionSafeGetTypes(Assembly assembly)
mvx:Diagnostic: 26.36 Setup: CommandCollectionBuilder start
mvx:Diagnostic: 26.37 Setup: NavigationSerializer start
mvx:Diagnostic: 26.37 Setup: InpcInterception start
mvx:Diagnostic: 26.38 Setup: LastChance start
mvx:Diagnostic: 26.38 Setup: Secondary end
mvx:Diagnostic: 26.43 Showing ViewModel LoginViewModel
Exception thrown: 'System.Collections.Generic.KeyNotFoundException' in Cirrious.MvvmCross.DLL
mvx:Diagnostic: 26.57 Error seen during navigation request to LoginViewModel - error KeyNotFoundException: Could not find view for MspManager.App.Core.ViewModels.LoginViewModel
at Cirrious.MvvmCross.Views.MvxViewsContainer.GetViewType(Type viewModelType)
at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewsContainer.GetXamlUriFor(MvxViewModelRequest request)
at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewPresenter.Show(MvxViewModelRequest request)
我终于找到了解决办法。问题是我在我的项目中使用了 Chance.MvvmCross.plugins.UserInteraction 插件,它适用于 MvvmCross v3。现在将 Birdie.MvvmCross.plugins.UserInteraction 替换为 MvvmCross v4 的 Chance.MvvmCross.plugins.UserInteraction,问题得到解决。
运行 WP 项目时出现此错误,但 Android 工作正常。我关注 this link 并尝试了所有选项,但没有成功。它不会在代码端引发错误,只会在输出 window 上显示错误消息,因此无法调试它并且应用程序无法启动。请帮助解决这个问题。
出现此错误:
******************* MVXApp.Initialize mvx:Diagnostic: 26.16 Setup: ViewModelTypeFinder start mvx:Diagnostic: 26.17 Setup: ViewsContainer start mvx:Diagnostic: 26.18 Setup: ViewDispatcher start mvx:Diagnostic: 26.18 Setup: Views start
Exception thrown: 'System.Reflection.ReflectionTypeLoadException' in mscorlib.ni.dll mvx:Warning: 26.36 ReflectionTypeLoadException masked during loading of MspManager.App.Phone81, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null - error ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeAssembly.get_DefinedTypes() at Cirrious.CrossCore.ReflectionExtensions.GetTypes(Assembly assembly) at Cirrious.CrossCore.IoC.MvxTypeExtensions.ExceptionSafeGetTypes(Assembly assembly)
mvx:Diagnostic: 26.36 Setup: CommandCollectionBuilder start mvx:Diagnostic: 26.37 Setup: NavigationSerializer start mvx:Diagnostic: 26.37 Setup: InpcInterception start mvx:Diagnostic: 26.38 Setup: LastChance start mvx:Diagnostic: 26.38 Setup: Secondary end mvx:Diagnostic: 26.43 Showing ViewModel LoginViewModel Exception thrown: 'System.Collections.Generic.KeyNotFoundException' in Cirrious.MvvmCross.DLL mvx:Diagnostic: 26.57 Error seen during navigation request to LoginViewModel - error KeyNotFoundException: Could not find view for MspManager.App.Core.ViewModels.LoginViewModel at Cirrious.MvvmCross.Views.MvxViewsContainer.GetViewType(Type viewModelType) at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewsContainer.GetXamlUriFor(MvxViewModelRequest request) at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhoneViewPresenter.Show(MvxViewModelRequest request)
我终于找到了解决办法。问题是我在我的项目中使用了 Chance.MvvmCross.plugins.UserInteraction 插件,它适用于 MvvmCross v3。现在将 Birdie.MvvmCross.plugins.UserInteraction 替换为 MvvmCross v4 的 Chance.MvvmCross.plugins.UserInteraction,问题得到解决。