android - DryIoc 容器异常仅在带有 Prism Android 应用的 XF 的 RELEASE 模式下
问题描述
我收到以下异常,但仅在使用w/容器和 Popups 插件(异常所指)构建的Xamarin.Forms
Android 应用程序的 RELEASE 构建中。该应用程序在调试中运行良好。我只使用 SDK 程序集链接。Prism
DryIoc
有没有人遇到过这个?
关于确定根本原因/修复的任何建议?
仅在发布模式下运行时出现此异常,我不知道为什么 - 有人可以帮我解决这个问题吗?在调试模式下完美运行。
尝试进行第一次导航时抛出异常(使用 INavigationService.NavigateAsync)。
DryIoc.ContainerException:'无法使用传递的参数解析 MyProject.ViewModels.LoginPageViewModel [value(Prism.Plugin.Popups.PopupPageNavigationService)] IsResolutionCall 从容器没有范围与规则与 {AutoConcreteTypeResolution} 和没有 {UseFastExpressionCompilerIfPlatformSupported} 与 Made={FactoryMethod= ConstructorWithResolvableArguments} 在 Rules.DynamicServiceProviders 的 0 中未找到服务注册且未找到动态注册,在 Rules.UnknownServiceResolvers 的 1 中未找到任何服务注册
我在用着:
Windows 10 上的 Visual Studio Enterprise 版本 16.2.5 Xamarin Forms 版本 4.2.0.778463 Prism.DryIoc.Forms 版本 7.2.0.1367 Prism.Plugin.Popups 版本 7.2.0.573 Rg.Plugins.Popup 版本 1.1.5.188
这是我的发布 csproj 设置,我对其进行了修改,以便在我的物理设备上对其进行调试:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <!-- get rid of debug -->
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidSupportedAbis>armeabi-v7a;</AndroidSupportedAbis>
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<BundleAssemblies>false</BundleAssemblies>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<AndroidEnableMultiDex>false</AndroidEnableMultiDex>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
</PropertyGroup>
这是App.xaml.cs中的注册,我用 Prism 的 [AutoRegisterForNavigation] 装饰了 App 类。我尝试显式注册 PopupNavigationService 和 Popups(前 2 行注释掉),但没有任何区别。
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
// Services / Plugins
//containerRegistry.RegisterInstance<IPopupNavigation>(PopupNavigation.Instance);
//containerRegistry.Register<Prism.Plugin.Popups.PopupPageNavigationService>();
containerRegistry.RegisterPopupNavigationService();
containerRegistry.RegisterInstance<IContactService>(CrossContactService.Current);
containerRegistry.Register<IDialogService, DialogService>();
containerRegistry.Register<IQuoteProviderService, QuoteProviderService>();
containerRegistry.Register<IMessageCheshirerService, MessageCheshirerService>();
containerRegistry.Register<IMessageTrackerService, MessageTrackerService>();
containerRegistry.Register<IEmailService, SendGridEmailService>();
containerRegistry.Register<IAnalyticsService, FakeAnalyticsService>();
containerRegistry.Register<IAuthenticationService, FakeAuthService>(); // note this overrides the real platform-specific implementations as desired
containerRegistry.Register<IApiManager, FakeApiManager>();
containerRegistry.Register<IInAppPurchaser, FakeInAppPurchaser>();
containerRegistry.Register(typeof(IApiService<>), typeof(ApiService<>));
// Non-Auto-Registered Views
containerRegistry.RegisterForNavigation<NavigationPage>();
}
解决方案
此错误消息是一个完全不同的嵌套依赖项的红鲱鱼,该依赖项未正确注册发布模式构建....请忽略。
推荐阅读
- windows - 通过批处理检查 Web 应用程序的可用性?
- router - 无法通过第二个路由器获取 IPv6
- mysql - MYSQL按月查询去年的年化销售额
- amazon-web-services - AWS ECS/FARGATE - 服务任务正在运行但没有容器实例
- java - Oracle:生成一个数字序列,其值以某个数字开头
- spring-boot - 处理并发更新 Spring Boot JPA,获取下一个数据库条目
- c++ - 在 main 方法中声明与在 main 方法外部声明时的其他结果
- kubernetes - Helm 模板浮点运算
- categories - Akeneo分类bug,不希望有答案,希望稍微通关
- php - mysql查询的错误结果-错误在哪里?