Test App failing on Back Button… Windows Phone 7

。_饼干妹妹 提交于 2020-01-03 05:55:10

问题


Ok this question stems from this question: wp7: App failing! Can not figure out where?

I thought it was corrected but it is still failing. I ripped out all of the app.xaml.cs code and it still crashing when the search button is clicked and the back button is immediately pressed.

So... I decided to see if I could replicate the issue with a new test app. Basically I have create a basic pivot application with the default Main View Model. None of my code exists...

I press the search button and then immediately press the back button and low and behold... The SAME THING HAPPENS.... It crashes the application, the emulator shows a blank screen and the debugger stops!

So... That leads me to believe that I've found a bug in the emulator (I find this very hard to believe)... OR, my Studio environment maybe is corrupted (I'm hoping it is not).

I'm not sure where to go on this one. I don't know what the error is, and it is preventing my apps from being accepted on the market place.

Does anyone have any ideas?

I made a screen capture of what I'm seeing:

Notice that the 1st 3 search/back combos work as the boxes in the search screen are allowed to display. However, the last 2 search/back combos don't work as you will see that the boxes aren't allowed to display...

http://www.youtube.com/watch?v=XVht3OtBGaI

The error report I'm getting from 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.

The other error report from a different application:

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.

I noticed that:

When the following happens in the debugger:

The thread '<No Name>' (0xd1b0092) has exited with code 0 (0x0).
The thread '<No Name>' (0xd6900ba) has exited with code 0 (0x0).

That the project DOES NOT FAIL as described (100% of the time). However, if I click the back button before this, then the application fails (100% of the time).

Update #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.
}

回答1:


OK, after hours of banging my head against my desk I have found that the emulator on some machines are having the same issue I am seeing.

So... The 1st thing I did was to wrap all my functions in Try/Catch blocks... Even the smallest functions and the ones that can't error. Then I side loaded the application to see if I can get it to crash. When I felt I sufficiently tested it on my phone I re-submitted the app. In the testing notes section I asked for them to test it on a device rather than an emulator. I never heard if they did this or not, but they passed my app, so I'm guessing that they did.

Thanks to @Praetorian and @Matt Lacey and @willmel and anyone else that took a look at this problem for me. I appreciate it!




回答2:


I also noticed that If you create an new wp7 application this also happend. Create a new application. Start it. When it has started press the Start button and immidiately click the back button. It now says Resuming.. but nothing happens. When you try to restart the app you only get to the splashscreen.

But I found out that if you build the app using Build=Release and dont debug the app (run it on a device) this does not occur..

Can you check if this is the case for you as well.. If so them im also in trouble



来源:https://stackoverflow.com/questions/5691302/test-app-failing-on-back-button-windows-phone-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!