本文介绍了在 Windows Phone 8 中,我不断收到 System.WIndows.Markup.XamlParseException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的错误信息是

System.Windows.Markup.XamlParseException"类型的第一次机会异常发生在 System.Windows.ni.dll 中

调用堆栈可追溯到这段代码.

The call stack traces back to this snippet of code.

 public MainPage()
        {
            **InitializeComponent();**
            this.Init();

            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);


        }

InitializeComponent() 行上的错误.

And errors on the InitializeComponent() line.

public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        System.Windows.Application.LoadComponent(this, new System.Uri("/App;component/MainPage.xaml", System.UriKind.Relative));
        this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
        this.SSIDTextBox = ((System.Windows.Controls.TextBox)(this.FindName("SSIDTextBox")));
        this.PasswordTextBox = ((System.Windows.Controls.TextBox)(this.FindName("PasswordTextBox")));
        this.Auth_ListPicker = ((Microsoft.Phone.Controls.ListPicker)(this.FindName("Auth_ListPicker")));
        this.SaveButton = ((System.Windows.Controls.Button)(this.FindName("SaveButton")));
        this.GenerateButton = ((System.Windows.Controls.Button)(this.FindName("GenerateButton")));
        this.QRImage = ((System.Windows.Controls.Image)(this.FindName("QRImage")));
        this.Profiles= ((System.Windows.Controls.ListBox)(this.FindName("Profiles")));
    }
}

在将 WP 7.1 转换为 WP8 之前,我没有收到此异常.

I did not get this exception before I converted the WP 7.1 to WP8.

任何帮助将不胜感激.

更新:我添加了整个异常消息,它有助于查明问题吗?

Update:I added the entire exception message, does it help pinpoint the issue?

'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: DefaultDomain): 加载了 'C:\windows\system32\mscorlib.ni.dll'.跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.Windows.RuntimeHost.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.Windows.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.Net.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.Xml.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\WifiQR.DLL".符号加载.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\Microsoft.Phone.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\Microsoft.Phone.Interop.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\Microsoft.Phone.Controls.工具包.DLL'.无法找到或打开 PDB 文件.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\microsoft.phone.controls.DLL'.无法找到或打开 PDB 文件.TaskHost.exe"(CLR C:\windows\system32\coreclr.dll:Silverlight AppDomain):加载C:\windows\system32\System.Core.ni.dll".跳过加载符号.模块已优化,调试器选项仅我的代码"已启用.System.Windows.Markup.XamlParseException"类型的第一次机会异常发生在 System.Windows.ni.dll 中

推荐答案

发现问题!我能够通过以下方式找到有关异常的更多信息:

Found the issue!I was able to find more information regarding the exception by:

  1. 调试->异常
  2. 按添加并输入System.Windows.Markup.XamlParseException"并选择公共语言运行时异常
  3. 再次运行,它将查明导致异常的确切行号.

结果是一个简单的错字.

It turned out to be a simple typo.

这篇关于在 Windows Phone 8 中,我不断收到 System.WIndows.Markup.XamlParseException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 09:49