调试版本(86,64,ARM)一切正常,发布版本构建正常,但是当它们运行时,我的应用程序窗口打开并保持空白(白色背景)。我在输出中看到的唯一错误是一大堆:
...PDB file was not present when IL code was compiled to native.
我不确定丢失的.pdb文件是否是罪魁祸首 - 相当确定他们不是,因为他们只是出于调试目的而对吗? 无论如何,这是我试图为Windows应用商店做好准备的第一个UWP应用程序,并且不能完全确定我是否必须做一些特别的事情,例如签名以在我自己的计算机上测试发行版本?
编辑1:感谢@Alan提供的建议,手动卸载应用程序有时会让我通过空白窗口加载应用栏,但是当它没有挂在启动画面上时我会收到这些错误:
Debugger Error 1, Debugger Error 2
我没有对启动画面做任何特殊处理,使用清单中的内置工具加载了所有可视资源,并且没有修改默认的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);
}
}
}
}
我已将opensource Template10中的FileService和SettingsService类添加到项目中。
构建设置&#34;使用.NET Native工具链编译&#34;未经检查,我已经尝试使用它来检查/取消选中调试/发布版本,现在调试版本也常常挂起在启动画面上?经过检查,我也得到了一大堆这些错误:
'Sublist.exe' (Win32): Loaded 'C:\Windows\System32\biwinrt.dll'. Skipped loading symbols. Module is native, and native debugging is currently disabled.
我尝试下载服务器符号但没有成功......
答案 0 :(得分:3)
我发现挂起发生在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内部频道中报告。