这段代码在我的WP8应用程序中工作正常:
void App_UnhandledException(object sender, UnhandledExceptionEventArgs args)
{
string appName;
string appVersion;
var xmlReaderSettings = new XmlReaderSettings
{
XmlResolver = new XmlXapResolver()
};
using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings))
{
xmlReader.ReadToDescendant("App");
appName = xmlReader.GetAttribute("Title");
appVersion = xmlReader.GetAttribute("Version");
}
WAMS_EXCEPTIONLOG wamsel = new WAMS_EXCEPTIONLOG
{
appNameAndVersion =
string.Format("{0} {1}", appName,
appVersion),
ExceptionMsg =
args.ExceptionObject.Message,
InnerException =
args.ExceptionObject
.InnerException.ToString(),
ExceptionToStr =
args.ExceptionObject.ToString(),
dateTimeOffsetStamp =
DateTimeOffset.UtcNow
};
await MobileService.GetTable<TASLS_WAMS_EXCEPTIONLOG>().InsertAsync(wamsel);
}
Run Code Online (Sandbox Code Playgroud)
...但在我的补充Windows商店应用程序中,几个类和类成员无法识别,即:
XmlResolver
XmlXapResolver
args.ExceptionObject
Run Code Online (Sandbox Code Playgroud)
(更不用说不允许等待的事实,并且向事件处理程序添加"async"会导致事件处理程序的赋值变为"变为红色")...
那么,回到主要观点:我如何通过我的Windows Store应用程序获得与WP8应用程序相同的功能?
c# exception-handling xml-parsing windows-phone-8 windows-store-apps
我正在构建一个 UWP 应用程序。当我打开应用程序的应用程序设置时,我想在规格部分显示应用程序的版本号。
例如,在下图中,您可以在应用程序设置的规格部分下看到版本号为 1.2.4.0。我如何为我的 UWP 应用程序做类似的事情。
我怎样才能实现这个目标?