【发布时间】:2011-04-17 03:42:19
【问题描述】:
好的,这个问题源于这个问题: wp7: App failing! Can not figure out where?
我认为它已得到纠正,但它仍然失败。我撕掉了所有 app.xaml.cs 代码,当单击搜索按钮并立即按下后退按钮时,它仍然崩溃。
所以...我决定看看是否可以使用新的测试应用来重现该问题。基本上我已经使用默认的主视图模型创建了一个基本的数据透视应用程序。我的代码都不存在...
我按下搜索按钮,然后立即按下返回按钮,然后低头看……同样的事情发生了……它使应用程序崩溃,模拟器显示一个空白屏幕,调试器停止!
所以...这让我相信我在模拟器中发现了一个错误(我觉得这很难相信)...或者,我的 Studio 环境可能已损坏(我希望它不是)。
我不知道该去哪里。我不知道错误是什么,它阻止了我的应用在市场上被接受。
有人有什么想法吗?
我截取了我所看到的内容:
请注意,1st 3 search/back 组合作为搜索屏幕中的框被允许显示。但是,最后 2 个搜索/返回组合不起作用,因为您会看到这些框不允许显示...
http://www.youtube.com/watch?v=XVht3OtBGaI
我从 Microsoft 收到的错误报告:
Comments: The application reactivate after deactivation and terminates unexpectedly.
Steps to reproduce:
1) Launch the application.
2) Select a vehicle.
3) Press the device's "Start" button.
4) Select the device's "Back" button.
5) Observe the application terminates unexpectedly and does not reactive the application.
This error is reproducible 8 out of 10 times.
来自不同应用程序的另一个错误报告:
Comments: The application terminates rather than resuming when the user attempts to return from a Search.
Steps to reproduce:
1. Launch the application
2. Select the Add + button
3. Press the Search button
4. Press the Back button
5. Observe the application terminates after a few seconds.
我注意到:
当调试器发生以下情况时:
The thread '<No Name>' (0xd1b0092) has exited with code 0 (0x0).
The thread '<No Name>' (0xd6900ba) has exited with code 0 (0x0).
项目没有像描述的那样失败(100% 的时间)。但是,如果我在此之前单击后退按钮,则应用程序会失败(100% 的时间)。
更新 #1:App.xaml.cs
// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
// Ensure that application state is restored appropriately
if (!App.ViewModel.IsDataLoaded)
{
App.ViewModel.LoadData();
}
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
// Ensure that required application state is persisted here.
}
【问题讨论】:
-
您是否以任何方式处理停用/激活?你能断点它们,看看哪里出了问题吗?
-
@willmel - 这是基本代码。请参阅我更新的问题。基本上该项目是一个全新的项目,除了 Pivot 应用程序附带的示例数据之外没有任何代码。
-
@Jeff V:您确定应用程序正在崩溃,而不仅仅是在您墓碑时调试器退出然后返回应用程序?启动应用程序,然后选择第二个数据透视项目。现在点击搜索并返回,当模拟器屏幕为空白且调试器已停止时,再次在 Visual Studio 中运行应用程序 (F5)。如果应用程序启动时选择了第二个数据透视项,那么您的问题只是应用程序被删除时调试器退出。
-
@Praetorian - 嗯......你如何解释它,确实发生了。基本上,当我按 F5 再次重新启动 VS 时,应用程序从它停止的地方启动。但是,此问题与 MS 报告我的应用程序未通过测试 (stackoverflow.com/questions/5530555/…) 的问题相同。有任何想法吗?我不知道该怎么办。
-
@Praetorian - 经过进一步审查......我尝试了您在我的测试应用程序中提到的相同步骤。我在测试应用程序中选择了第二个枢轴项目,我点击了搜索按钮,然后回击。调试器停止。我按 f5,第一个枢轴项目出现了。上面的评论是关于我构建的应用程序的。我选择了一个将我带到不同页面的项目...当我重新启动应用程序 (f5) 时,我离开的页面又回来了。
标签: windows-phone-7