Hi, my name is Alex.
I'm currently learning after a book about how to convert xaml code into objects during runtime.
I have the following code:
try
{
ctrl = XamlReader.Load(xaml) as UserControl;
}
catch (Exception exc)
{
OnXamlResult(new XamlCruncherEventArgs(exc.Message)); return;
}
The code is not mine, I took it from the book.
The problem is that try-catch does not work properly, or at least as I know till now.
During debugging the program stops when it reaches the line :
ctrl = XamlReader.Load(xaml) as UserControl;
without catching the exception.
What am I doing wrong or how can I solve this problem?
Thanks in advance!
Sorry for missing some things.
xaml is a string. It is taken form a textbox and if the xaml is correctly typed by the user the program should convert the xaml code into object otherwise it should display the corresponding error.
About how the program reacts, i can say that debug stops and it is not behaving like going into a infinite cycle.