Windows 应用商店应用:我的应用在切换后终止 [英] Windows Store Apps: my app terminates after being switched

查看:32
本文介绍了Windows 应用商店应用:我的应用在切换后终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个 Windows 8 应用.

I'm building a Windows 8 app.

我的问题是当用户切换到另一个应用程序或开始时,应用程序终止.在侧边栏中,我发现应用的预览显示启动画面,当我点击应用时,它从头开始.

My problem is when the user switches to another app or goes to start, the app terminates. In the side bar I find the preview of the app to be displaying the splash screen, when I click on the app it starts from the beginning.

这里有什么问题,可能是内存问题吗?在任务管理器中,我的应用占用了 40 MB 的内存,是否太多了?

What can be the problem here, could it be a memory issue ? In the task manager my app takes 40 MB of memory, is that too much ?

事件查看器在应用崩溃时显示以下内容:

The Event Viewer shows the following when the app crashes:

应用:MyApp.exe 框架版本:v4.0.30319 描述:由于未处理的异常,进程被终止.异常信息:MyApp.Common.SuspensionManagerException 堆栈:在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在System.Threading.WinRTSynchronizationContext+Invoker.b__0(System.Object)在System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)在System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback, System.Object, Boolean) atSystem.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback, System.Object, Boolean) atSystem.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()在 System.Threading.ThreadPoolWorkQueue.Dispatch() 在System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Application: MyApp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: MyApp.Common.SuspensionManagerException Stack: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.WinRTSynchronizationContext+Invoker.b__0(System.Object) at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

推荐答案

从您的堆栈跟踪来看,暂停管理器似乎正在抛出异常.我在暂停管理器中发现的异常的最常见原因是尝试在页面之间传递复杂对象作为导航参数.如果您要传递完整的业务对象,请尝试只传递 ID.我知道这很疯狂,但这就是默认实现的方式.

From your stack trace it looks like the suspension manager is throwing an exception. The most common cause of exceptions I've found in the suspension manager is in trying to pass complex objects between pages as a navigation parameter. If you are passing a complete business object around, then try just passing the ID. I know it's crazy, but that's the way it is with the default implementation.

这篇关于Windows 应用商店应用:我的应用在切换后终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆