Silverlight 3 XamlReader Exception not caught

Posted by Andrej on Stack Overflow See other posts from Stack Overflow or by Andrej
Published on 2009-11-09T14:01:12Z Indexed on 2010/05/07 14:18 UTC
Read the original article Hit count: 647

Hi,

when I use XamlReader.Load() with an invalid XAML string, the resulting XAMLParseException is not caught although beeing in a try-catch-block:

 try
 {
        UIElement xamlCode = XamlReader.Load(XamlText) as UIElement;
 }
 catch (Exception ex)
 {
        ErrorText = ex.Message;
 }

The code is called from the Tick-Event of a DispatcherTimer, but also in Events like MouseLeftButtonDown the exception is not caught resulting in a break in the Line where I call .Load().

Does anyone know how to catch this Exception and resume normal programm activity?

Thanks, Andrej

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about xamlreader