Archive

Archive for March 19, 2014

A first chance exception of type ‘System.Windows.Markup.XamlParseException’ – WP8

Other day I got below error while executing my application.

A first chance exception of type ‘System.Windows.Markup.XamlParseException’ occurred in System.Windows.ni.dll

The exception was in ‘App.xaml.cs’ file’s InitializeComponent() method

XamlParseException

XamlParseException

Reason

  • There could be many reasons for the exception
  • Even if there is an invalid space in your xaml file it throws the exception

Fix

  • To get the exact reason for the issue, add the exception in your ‘Debug’
    • Debug->Exceptions
    • Press Add and type in, “System.Windows.Markup.XamlParseException” and select Common Language Runtime Exceptions
Add Exception

Add Exception

    • Run the application
    • It will pinpoint the exact reason for the exception
  • In my case I had an empty space in my xaml file

🙂