To workaround this .net bug, change all of the Solid Color Brushes in your code to be freezeable. For example
<SolidColorBrush x:Key="WindowBackground" Color="Black" />
should be changed to:
<SolidColorBrush po:Freeze="True" x:Key="WindowBackground" Color="Black" />.
For more detailed instructions see here: How can WPF objects deriving from Freezable be frozen in XAML?.