简体   繁体   English

在Android上关闭应用程序后,Prism + Xamarin.Forms Project错误?

[英]Prism + Xamarin.Forms Project error after closing app on Android?

I am developing an app using Prism and Xamarin Forms. 我正在使用Prism和Xamarin Forms开发应用程序。 I used Prism template to create the project in Visual Studio 2017 community edition. 我使用Prism模板在Visual Studio 2017社区版中创建项目。

Here is the app.cs page 这是app.cs页面

protected override void OnInitialized()
{
    InitializeComponent();

    NavigationService.NavigateAsync("BasePage");
}

protected override void RegisterTypes()
{
    Container.RegisterTypeForNavigation<BasePage>();
    Container.RegisterTypeForNavigation<MainNavigationPage>();
    Container.RegisterTypeForNavigation<MilkPurchasePage>();
    Container.RegisterTypeForNavigation<TruckSheetPage>();
    Container.RegisterTypeForNavigation<LocalSalePage>();
    Container.RegisterTypeForNavigation<MembersPage>();
}

Now BasePage contains Hamburger menu and from there it will navigate to MilkPurchasePage 现在, BasePage包含Hamburger菜单,并从那里导航到MilkPurchasePage

Now everything works when I run the project on mobile but once I close the app I get 现在,当我在移动设备上运行项目时,一切都可以正常工作,但是一旦关闭应用程序,我就会得到

Unfortunately , MilkApp.Droid has stopped.

I only added user interface. 我只添加了用户界面。 No background code has been added other than navigation. 除导航外,未添加任何背景代码。

I tried to debug bug I am unable to get it in visual studio. 我尝试调试无法在Visual Studio中获得的错误。 I checked all errors in Error Settings too. 我也检查了“错误设置”中的所有错误。 But still I am unable to solve it. 但是我仍然无法解决它。

Why I am getting this ? 为什么我得到这个?

This is actually an issue with Xamarin.Forms. 这实际上是Xamarin.Forms的问题。 They fixed this in the past, but it looks like they may have had a regression. 他们过去曾解决此问题,但看起来他们可能已经回归了。 You can easily reproduce this by creating a standard XF application. 您可以通过创建标准XF应用程序轻松重现此内容。 You should submit this as a bug to Xamarin. 您应该将此作为Bug提交给Xamarin。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM