此代码中的“RootFrame =”行,所有这些都是自动生成的:
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Handle reset requests for clearing the backstack
RootFrame.Navigated += CheckForResetNavigation;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
...失败了:
* System.TypeInitializationException未被用户代码处理HResult = -2146233036 Message =类型初始值设定项 'TaSLS_PhoneApp.App'抛出异常。来源= TaSLS_PhoneApp
TypeName = TaSLS_PhoneApp.App StackTrace: at TaSLS_PhoneApp.App.set_RootFrame(PhoneApplicationFrame value) 在TaSLS_PhoneApp.App.InitializePhoneApplication() at TaSLS_PhoneApp.App..ctor()InnerException:System.NotImplementedException 的HResult = -2147467263 Message =未实现方法或操作。 来源=视窗 堆栈跟踪: 在Windows.Storage.ApplicationData.get_RoamingSettings() 在TaSLS_PhoneApp.App..cctor() 的InnerException:*
答案 0 :(得分:2)
根本原因不是生成的代码,而是它正在调用的代码......
TaSLS_PhoneApp.App.InitializePhoneApplication()at TaSLS_PhoneApp.App..ctor() InnerException:System.NotImplementedException HResult = -2147467263 Message =方法或 操作没有实现。 Source = Windows StackTrace:at TaSLS_PhoneApp.App..cctor()上的Windows.Storage.ApplicationData.get_RoamingSettings() 的InnerException:*
在您的应用中InitializePhoneApplication
看起来正在调用WinRT功能,该功能未在Windows Phone 8上实现。请参阅MSDN文档:
http://msdn.microsoft.com/en-gb/library/windows/apps/windows.storage.applicationdata.roamingsettings