Archive

Posts Tagged ‘WP8’

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

🙂

Text to Speech – WP8

Windows Phone 8 has included the Text to Speech feature out of the box in the platform.Text to speech is very easy to use in your App (only takes 2 lines of code) using ‘SpeechSynthesizer’ class.

Text to Speech

Text to Speech

Below is the code

            var synthesizer = new SpeechSynthesizer();

await synthesizer.SpeakTextAsync(“Your text here”);

Copy and paste above code in button ‘Click’ event.

Also we can set the ‘VoiceInformation’ (i.e., Language, Gender etc…) to the speech.

Refer link for more details.

🙂