[英]UWP app release version hangs on splash screen?
調試版本(86、64,ARM)都可以正常工作,發布版本可以正常運行,但是當它們運行時,我的應用程序窗口打開並保持空白(白色背景)。 我在輸出中看到的唯一錯誤是一堆錯誤:
...PDB file was not present when IL code was compiled to native.
我不確定丟失的.pdb文件是否是罪魁禍首-可以肯定的是,不是,因為它們只是出於調試目的,對吧? 無論如何,這是我嘗試為Windows應用商店准備的第一個UWP應用,並且不確定是否需要做一些特別的事情,例如在我自己的計算機上進行簽名以測試發行版本?
編輯1:謝謝@Alan的建議,手動卸載應用程序有時使我越過空白窗口來加載應用程序欄,但是當它沒有掛在初始屏幕上時,我得到了這些錯誤:
我沒有對啟動屏幕做任何特別的事情,使用清單中的內置工具加載了所有視覺資源,並且沒有修改App.xaml.cs的默認設置。 這是我的Mainpage.cs:
using Sublist.Classes;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Sublist
{
public sealed partial class MainPage : Page
{
const string TAG = "MainPage: ";
// for loading and saving user data and settings
public static DataHandler dataHandler;
public static MasterList<Entry> masterList;
//public static int listViewSelectedIndex = -1;
public MainPage()
{
this.InitializeComponent();
dataHandler = new DataHandler(this);
masterList = new MasterList<Entry>();
// load user data
if (dataHandler.userDataList != null)
masterList = dataHandler.userDataList;
masterList.UpdateListView(this);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
dataHandler.LoadUserSettings();
}
private void AppBarAdd_Click(object sender, RoutedEventArgs e)
{
masterList.AddRow(this);
}
private void AppBarRemove_Click(object sender, RoutedEventArgs e)
{
if (!(mainListView.SelectedIndex < 0))
{
masterList.RemoveRow(this);
}
}
private void AppBarMoveDown_Click(object sender, RoutedEventArgs e)
{
}
private void AppBarMoveUp_Click(object sender, RoutedEventArgs e)
{
}
private void AppBarIndent_Click(object sender, RoutedEventArgs e)
{
// indent the row control if currently selected index is a list view item
if (-1 < mainListView.SelectedIndex && mainListView.SelectedIndex < mainListView.Items.Count)
{
// but don't allow more than one indent past above row's indent level
RowControl rc = (RowControl)mainListView.Items[mainListView.SelectedIndex];
int indexMinus1 = mainListView.SelectedIndex - 1;
if (-1 < indexMinus1 && rc.indentProp <= masterList[indexMinus1].indent)
{
rc.indentProp++;
}
}
// then update list view
masterList.UpdateListView(this);
}
private void AppBarUnindent_Click(object sender, RoutedEventArgs e)
{
// unindent the row control if currently selected index is a list view item
if (-1 < mainListView.SelectedIndex && mainListView.SelectedIndex < mainListView.Items.Count)
{
// but don't allow unindenting off left side of page
RowControl rc = (RowControl)mainListView.Items[mainListView.SelectedIndex];
if (rc.indentProp > 0)
{
rc.indentProp--;
}
}
// then update list view
masterList.UpdateListView(this);
}
public void AppBarShowCompl_Click(object sender, RoutedEventArgs e)
{
dataHandler.SaveUserSettings();
masterList.UpdateListView(this);
}
public void AppBarMarkAsCompleted_Click(object sender, RoutedEventArgs e)
{
// toggle hidden state of active entry
if (-1 < mainListView.SelectedIndex && mainListView.SelectedIndex < masterList.Count)
{
masterList[mainListView.SelectedIndex].completed = (masterList[mainListView.SelectedIndex].completed) ? false : true;
masterList.UpdateListView(this);
}
}
}
}
我已經將開源Template10中的FileService和SettingsService類添加到了項目中。
未選中構建設置“使用.NET Native工具鏈進行編譯”,我嘗試使用它來部署/調試/釋放兩個調試/發布版本,現在調試版本也經常掛在初始屏幕上嗎? 選中它,我也收到了很多這些錯誤:
'Sublist.exe' (Win32): Loaded 'C:\Windows\System32\biwinrt.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
我嘗試下載服務器符號沒有成功...
我發現該掛起發生在GetIfFileExitsAsync的以下行中。
retval = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync(key);
我對您的代碼進行了以下更改,並且現在應該可以使用。
在DataHandler的構造函數中,使用Task.Run初始化userDataList。
public DataHandler(MainPage mp)
{
mainPage = mp;
settingsHelper = new SettingsHelper();
fileHelper = new FileHelper();
LoadUserSettings();
Task.Run(() =>
{
userDataList = LoadUserData();
});
Task.WaitAll();
}
我仍然不確定為什么.net本機編譯會導致此問題,但是會嘗試簡化項目並在MS內部通道中報告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.