I found that the XAML content that I read from the file contained BOM.
I BOM is stripped out, the XAML code is parsable.
I use Visual Studio 2010. The “Text Visualizer” in debugging mode did not show any sign of BOM (the XAML string is in UTF8). But when I accidently copied the text from the visualizer and pasted in Notepad++, it showed ‘?’ symbol (BOM, in this case.)
Bah. Weird problems in VS.
solved Unable to parse XAML/XML