In Windows Phone 8, I keep getting a System.WIndows.Markup.XamlParseException

12,648

Solution 1

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

  1. Debug->Exceptions
  2. Press Add and type in, "System.Windows.Markup.XamlParseException" and select Common Language Runtime Exceptions
  3. Run again and it will pinpoint the exact line number causing the exception.

It turned out to be a simple typo.

Solution 2

Just add the permission in your manifest file.

  1. Go to WMAppmanifest.xml
  2. Select the "Capabalities" tab
  3. Now check "ID_CAP_MAP"
Share:
12,648
Davy Li
Author by

Davy Li

Updated on June 04, 2022

Comments

  • Davy Li
    Davy Li almost 2 years

    The error message I get is

    A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in 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);
    
    
            }
    

    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")));
        }
    }
    

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

    Any help would be appreciated.

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

    'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\WifiQR.DLL'. Symbols loaded. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\Microsoft.Phone.Controls.Toolkit.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs{64003C1B-A4FD-41FF-A132-2B6C9FE8EDC9}\Install\microsoft.phone.controls.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Core.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll

  • doubleJ
    doubleJ over 10 years
    That fixed my problem.
  • Zaheer Mehmood
    Zaheer Mehmood about 10 years
    Also fixed my problem :)
  • BMac
    BMac about 9 years
    can you add a little more detail to your answer, like what that key combo does. If MS change the key combo in a later release of VS this answer will not help other users.
  • Stephen Tetreault
    Stephen Tetreault over 7 years
    The Windows Phone is in a sorry state if they ever want people to take it seriously as a platform for development.