Windows phone 7 在WindowsPhone8中,我不断得到System.Windows.Markup.XamlParseException

Windows phone 7 在WindowsPhone8中,我不断得到System.Windows.Markup.XamlParseException,windows-phone-7,windows-phone,windows-phone-8,Windows Phone 7,Windows Phone,Windows Phone 8,我收到的错误消息是 System.Windows.ni.dll中首次出现类型为“System.Windows.Markup.XamlParseException”的异常 调用堆栈可以追溯到这段代码 以及InitializeComponent()行上的错误 在将WP7.1转换为WP8之前,我没有得到这个异常 任何帮助都将不胜感激 更新: 我添加了整个异常消息,它是否有助于查明问题 'TaskHost.exe'(CLR C:\windows\system32\coreclr.dll:Default

我收到的错误消息是

System.Windows.ni.dll中首次出现类型为“System.Windows.Markup.XamlParseException”的异常

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

以及InitializeComponent()行上的错误

在将WP7.1转换为WP8之前,我没有得到这个异常

任何帮助都将不胜感激

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

'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.Toolkit.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.ni.dll中首次出现类型为“System.Windows.Markup.XamlParseException”的异常

找到了问题! 我可以通过以下方式找到有关异常的更多信息:

  • 调试->异常
  • 按Add并键入“System.Windows.Markup.XamlParseException”,然后选择公共语言运行时异常
  • 再次运行,它将精确定位导致异常的确切行号

  • 结果是一个简单的输入错误。

    只需在清单文件中添加权限即可

  • 转到WMAppmanifest.xml
  • 选择“能力”选项卡
  • 现在检查“ID\U CAP\U MAP”

  • 我有一个类似的问题,并发现重新添加点击事件修复了它


    它发生在我从另一个xaml页面复制xaml时。

    WP8更新后VS Express中应用程序的Strg+Alt+F7有帮助。

    异常中没有更多信息吗?消息部分说什么?(我似乎记得类似的事情很难解决,但总是有比你提供的更多的信息。)很难猜出哪里出了问题。尝试删除部分xaml页面,直到它开始工作,或者尝试在内部异常中向我们显示消息。我包含了整个输出。这有助于查明问题所在吗?我还尝试删除xaml页面的部分内容,但仍然引发异常。发现问题!我使用了以下步骤:有关异常的详细信息可以通过以下方式找到:调试->异常按Add并键入“System.Windows.Markup.XamlParseException”,然后选择“公共语言运行时异常再次运行”以查找引发异常的确切原因。@DavyLi,您也可以回答自己的问题,事实上,我们鼓励您在Stackoverflow.com上这样做,它解决了我的问题。也解决了我的问题:)您可以在您的答案中添加更多的细节,就像那个按键组合所做的那样。如果微软在以后的VS版本中更改了按键组合,这个答案将不会帮助其他用户。如果Windows Phone希望人们把它作为一个开发平台来认真对待,那么它将处于一种令人遗憾的状态。
     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);
    
    
            }
    
    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")));
        }
    }