C# 为什么自动生成的WP8初始化代码会失败?
此代码中的“RootFrame=”行,所有这些都是自动生成的:C# 为什么自动生成的WP8初始化代码会失败?,c#,initialization,windows-phone-8,windows-phone-8-emulator,C#,Initialization,Windows Phone 8,Windows Phone 8 Emulator,此代码中的“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
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\u PhoneApp.App”引发了异常。Source=TaSLS\u PhoneAppTypeName=TaSLS\u PhoneApp.App StackTrace: 在TaSLS\u PhoneApp.App.set\u RootFrame(PhoneApplicationFrame值) 在TaSLS_PhoneApp.App.InitializePhoneApplication()上 在TaSLS_PhoneApp.App..ctor()内部异常:System.NotImplementedException HResult=-2147467263 消息=未实现该方法或操作。 来源=Windows 堆栈跟踪: 在Windows.Storage.ApplicationData.get_RoamingSettings()中 在TaSLS_PhoneApp.App..cctor()上 内部异常:*
根本原因不是生成的代码,而是它正在调用的代码 TaSLS_PhoneApp.App.InitializePhoneApplication()位于TaSLS_PhoneApp.App..ctor()处 InnerException:System.NotImplementedException HResult=-2147467263 Message=方法或 操作未执行。Source=Windows StackTrace:at TaSLS\u PhoneApp.App..cctor()上的Windows.Storage.ApplicationData.get\u RoamingSettings() 内部异常:* 在应用程序的
InitializePhone应用程序中,
似乎正在调用Windows phone 8上未实现的WinRT函数。请参阅MSDN文档,网址为: