[英]Windows App Certification Kit: Crashes and hangs test failed
我即將完成我的第一個Windows Store App,最近兩天,我在使用Windows App Certification Kit進行App測試期間遇到了問題。
該測試在“崩潰並掛起”測試中失敗,並且收到以下消息:
Crashes and hangs
Error Found: The crashes and hangs test detected the following errors:
Application ....................0.0.12_x86__jarrs3vj594qe was detected by Windows Error Reporting and experienced a crash or hang.
Impact if not fixed: An app that stops responding or crashes can cause data loss and is a poor user experience.
How to fix: Investigate, debug the executable(s) in question to identify and fix the problem, then rebuild and re-test the app.
在調試模式下對Suspension和Shutdown進行了一些測試后,我發現我的應用程序崩潰了: 並且錯誤表明SuspensionManager在以下位置失敗:weather.Common.SuspensionManager.RestoreAsync();
我認為此問題與我的“擴展飛濺屏幕”有關,而沒有“擴展飛濺屏幕”,我沒有收到此錯誤,並且應用通過了“崩潰並掛起”測試。 這是App.xaml.cs和擴展初始屏幕的代碼:
sealed partial class App : Application
{
// Defining gloabal variables used across the App
public string[] NavigateData { get; set; }
public NavigationCacheMode NavigationCacheMode { get; set; }
public parameterItem max1DayAgo = new parameterItem();
public parameterItem min1DayAgo = new parameterItem();
public parameterItem max1WeekAgo = new parameterItem();
public parameterItem min1WeekAgo = new parameterItem();
public parameterItem max1MonthAgo = new parameterItem();
public parameterItem min1MonthAgo = new parameterItem();
public List<NameValueItem> tempTrends24Hours = new List<NameValueItem>();
public List<NameValueItem> tempTrends30Days = new List<NameValueItem>();
public List<NameValueItem> windSpeedTrends24Hours = new List<NameValueItem>();
public List<NameValueItem> windSpeedTrends30Days = new List<NameValueItem>();
public List<NameValueItem> windDirectionTrends24Hours = new List<NameValueItem>();
public List<NameValueItem> windDirectionTrends30Days = new List<NameValueItem>();
public List<NameValueItem> windChillTrends24Hours = new List<NameValueItem>();
public List<NameValueItem> windChillTrends30Days = new List<NameValueItem>();
public List<NameValueItem> humidityTrends24Hours = new List<NameValueItem>();
public List<NameValueItem> humidityTrends30Days = new List<NameValueItem>();
public string appBackgGround;
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
protected async override void OnLaunched(LaunchActivatedEventArgs args)
{
//
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
{
Window.Current.Activate();
return;
}
Frame rootFrame = Window.Current.Content as Frame;
//Getting live tile data
var uris = new List<Uri>
{
new Uri("..........WebService.asmx/GetFirstTile"),
new Uri("............./GetSecondTile"),
new Uri("................./GetStatisticTile"),
new Uri(".............../GetNewsTile1"),
new Uri("............../GetNewsTile2"),
};
TileUpdater LiveTileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
LiveTileUpdater.EnableNotificationQueue(true); // Enable notifications
LiveTileUpdater.Clear(); // Clear the current set of updates
LiveTileUpdater.StartPeriodicUpdateBatch(uris, PeriodicUpdateRecurrence.HalfHour);
//getting bacground image
try
{
ServiceReference.WebServiceSoapClient webServiceObj = new ServiceReference.WebServiceSoapClient();
appBackgGround = await webServiceObj.GetBackgroundImageAsync();// Get the name of the Background picture
}
catch
{
appBackgGround = "backgroundImageBlueSky.jpg";
}
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
weather.Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame");
// Her we set the application background Image for all pages "backgroundImageBlueSky.jpg"
rootFrame.Background = new ImageBrush
{
Stretch = Windows.UI.Xaml.Media.Stretch.UniformToFill,
ImageSource = new BitmapImage { UriSource = new Uri("ms-appx:///Assets/" + appBackgGround) }
};
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
await weather.Common.SuspensionManager.RestoreAsync();
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// Navigating to the extended splash screen
if (!rootFrame.Navigate(typeof(ExtendedSplashScreen), rootFrame.GetNavigationState()))
{
throw new Exception("Failed to create initial page");
}
}
// About page
var _Helper = new Flyouts.SettingsHelper();
_Helper.AddCommand<Flyouts.About>("About");
Window.Current.Activate();
}
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
await weather.Common.SuspensionManager.SaveAsync();
deferral.Complete();
}
}
擴展的初始屏幕的代碼:在這里,我進行了一些Web服務調用,以便為第一頁加載數據。
public sealed partial class ExtendedSplashScreen : Page
{
public ExtendedSplashScreen()
{
this.InitializeComponent();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
/*
* ........
* ..........
* ...........
* ...........
* ............
* Here i do some webservice calls to get data for the first page(Mainpage
*
*/
(App.Current as App).NavigateData = startupData;// save the data for the Mainpage to the Global variables
this.Frame.SetNavigationState(e.Parameter as string);
this.Frame.Navigate(typeof(MainPage));// Finally navigate to the Mainpage
}
}
}
有什么想法我可以解決這個問題嗎?
您是否將Visual Studio 2012更新為更新2? 如果不是,請重試。 無論如何,請確保啟動時間不會超過5秒,否則您將無法通過認證。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.