【问题标题】:Test App failing on Back Button... Windows Phone 7测试应用程序在返回按钮上失败... Windows Phone 7
【发布时间】: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


【解决方案1】:

好的,经过数小时的头撞桌子后,我发现某些机器上的模拟器遇到了与我看到的相同的问题。

所以...我做的第一件事就是将所有函数包装在 Try/Catch 块中...即使是最小的函数和不会出错的函数。然后我侧加载应用程序,看看我是否可以让它崩溃。当我觉得我在手机上对其进行了充分测试时,我重新提交了该应用程序。在测试说明部分,我要求他们在设备而不是模拟器上对其进行测试。我从未听说他们是否这样做,但他们通过了我的应用程序,所以我猜他们这样做了。

感谢@Praetorian 和@Matt Lacey 和@willmel 以及其他为我研究这个问题的人。我很感激!

【讨论】:

    【解决方案2】:

    我还注意到,如果您创建一个新的 wp7 应用程序,也会发生这种情况。 创建一个新的应用程序。启动它。 当它开始按开始按钮并立即单击后退按钮。它现在说 Resuming.. 但没有任何反应。 当您尝试重新启动应用程序时,您只会进入启动画面。

    但我发现,如果您使用 Build=Release 构建应用程序并且不调试应用程序(在设备上运行),则不会发生这种情况..

    你能检查一下你是否也是这种情况。如果是这样,他们我也有麻烦

    【讨论】:

    • 如果它在设备上没有失败,那么您可能会提交应用程序并请求技术异常,建议他们在设备上进行测试,因为模拟器似乎运行不正确。或者在 AppHub 论坛中询问问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多