I am getting the following exception, but only in the RELEASE build for a Xamarin.Forms
Android app built with Prism
w/ DryIoc
container and the Popups Plugin (which the exception is referring to). The app runs fine in DEBUG. I am only using SDK assembly linking.
Has anyone run into this?
Any suggestions for determining root cause/fixing?
I get this exception when running in Release mode only and I have no idea why - can someone please help me with this? Works perfectly in Debug mode.
The exception gets thrown when attempting to do the first navigation (using INavigationService.NavigateAsync).
DryIoc.ContainerException: 'Unable to resolve MyProject.ViewModels.LoginPageViewModel with passed arguments [value(Prism.Plugin.Popups.PopupPageNavigationService)] IsResolutionCall from Container without Scope with Rules with {AutoConcreteTypeResolution} and without {UseFastExpressionCompilerIfPlatformSupported} with Made={FactoryMethod=ConstructorWithResolvableArguments} Where no service registrations found and no dynamic registrations found in 0 of Rules.DynamicServiceProviders and nothing found in 1 of Rules.UnknownServiceResolvers'
I'm using:
Visual Studio Enterprise version 16.2.5 on Windows 10 Xamarin Forms version 4.2.0.778463 Prism.DryIoc.Forms version 7.2.0.1367 Prism.Plugin.Popups version 7.2.0.573 Rg.Plugins.Popup version 1.1.5.188
Here are my release csproj settings, which I modified to let me debug it on my physical device:
<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>
Here's the registration in App.xaml.cs, and I have decorated the App class with Prism's [AutoRegisterForNavigation]. I Tried to explicitly register PopupNavigationService and Popups (the first 2 commented out lines) but it didn't make a difference.
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>();
}