【发布时间】:2014-02-12 03:52:53
【问题描述】:
我正在从“PRISM for windows runtime 8.1”创建一个新项目。每次我试图点击设置魅力时,应用程序都会崩溃。但是从 8.0 创建一个新项目不会使应用程序崩溃。有人知道如何解决这个问题吗?
我得到的错误是
Message = "System.NullReferenceException:对象引用未设置为 一个对象的实例。\r\n at Microsoft.Practices.Prism.StoreApps.MvvmAppBase.OnCommandsRequested(SettingsPane 发件人,SettingsPaneCommandsRequestedEventArgs args)"
编辑:这是崩溃时自动生成的文件。
namespace TestApp
{
#if !DISABLE_XAML_GENERATED_MAIN
public static class Program
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
static void Main(string[] args)
{
global::Windows.UI.Xaml.Application.Start((p) => new App());
}
}
#endif
partial class App : global::Microsoft.Practices.Prism.StoreApps.MvvmAppBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
private bool _contentLoaded;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
#if DEBUG && !DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT
DebugSettings.BindingFailed += (sender, args) =>
{
global::System.Diagnostics.Debug.WriteLine(args.Message);
};
#endif
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); <---- the debugger stays on this line.
};
#endif
}
}
}
【问题讨论】:
-
能否请您证明您的相关代码引发了该异常?
-
@SonerGönül 我什至还没有开始编写任何代码。所有代码都来自模板。但是当尝试运行应用程序并单击设置魅力时,它会崩溃。
标签: c# windows-store-apps