This project has moved. For the latest updates, please go here.

Internal error when converting XAML file

Dec 17, 2012 at 5:49 PM

I get this internal error image in Visual Studio when I try to use the XamlImageConverter; can someone offer a solution?


Warning 1 An internal error occurred

'Collection property 'XamlImageConverter.Elements.XamlImageConverter'.'Children' is null.' Line number '7' and line position '6'.
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, Boolean skipJournaledProperties, Uri baseUri)
   at System.Windows.Markup.XamlReader.Load(XamlReader xamlReader, ParserContext parserContext)
   at System.Windows.Markup.XamlReader.Load(XmlReader reader, ParserContext parserContext, XamlParseMode parseMode)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at XamlImageConverter.Group.get_Element()
   at XamlImageConverter.Snapshot.Process()
   at XamlImageConverter.Compiler.Compile(DateTime Version, XElement config) C:\Users\913458\Documents\Visual Studio 2012\Projects\WpfApplication2\WpfApplication2\XAMLconvert.xaml DOOR



I am trying to convert a xaml file named 'Door.xaml' into a PNG, and this is the code in the CreateImages.xic.xaml

<?xml version="1.0" encoding="utf-8" ?>


xic: XamlImageConverter





:x="" xmlns:d="" xmlns:mc="" mc:Ignorable="d" d:DesignWidth="307" d:DesignHeight="344">


<xic:Scene OutputPath="~/img" File="Door.xaml">


<xic:Snapshot File="Door.png" />





Feb 9, 2013 at 8:05 AM
As the error is happening in WpfXamlLoader.Load it looks like the converter is not able to load your xaml, so probably there is an error in your xaml. Notice that you can set the build action of the xic.xaml to either PreBuild or PostBuild. When you use PreBuild you can only use loose xaml and not compiled xaml, you can't for examle use resource images then.
When you use PostBuild and want to use compiled xaml, I believe (not sure anymore) you must specify a Type instead of a File in the Scene, like this:
<xic:Scene Type="MyNamespace.MyType, MyAssembly" >
Marked as answer by simonegli on 7/20/2015 at 1:19 PM