Q:

Markup Extension not working when WPF window is loaded through interop

I am opening WPF windows from a VB6 application as a part of a migration process to .NET. The windows are in a C# class library. I am getting a XamlParseException (stack trace below) that only occurs when the XAML window is loaded through a COM-exposed class. The .NET files for that are below.
I am not getting any issues loading the window from a .NET Console application using the classes below. But the code to load it from the console application is nearly identical minus a call to dispatcher.run() in the console app. So I'm not sure why interop is changing the behavior here.
The XamlParseException says "The method or operation is not implemented". The Stack trace is at the bottom of this post. It occurs in WindowA.xaml. I've commented above the line it occurs on. It's happening at <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=MainBrush}"/>
The Project Files
WindowWrapper.cs - Exposes the window to a VB6 application through COM
[ComVisible(true),
 ClassInterface(ClassInterfaceType.AutoDual)]
public class WindowWrapper
{
    //Note: This function is exposed to COM so that VB6 apps can call it.
    public void OpenWindow()
    {
        Dispatcher.CurrentDispatcher.Invoke(() =>
        {
            var window = new WindowA();
            window.ShowDialog();
        });

        //WPF will use the running Win32 dispatcher from VB6, so no need to call .Run() here
    }
}

WindowA.xaml.cs
public partial class WindowA : Window
{
    public WindowA()
    {
        // This is sort of a hacky way of getting a xaml dependency to load and
        // getting Visual Studio to track the dependencies across projects
        // So we don't have to manually copy or include them in some way.
        // This reference to Localization manager will cause the proper assembly to load.
        var twc = typeof(LocalizationManager); // Telerik.Windows.Controls.dll

        InitializeComponent();
    }
}

WindowA.xaml - Xaml file that fails to load when using COM Interop
<Window x:Class="TelerikProject.WindowA"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
            mc:Ignorable="d"
            d:DesignHeight="300" d:DesignWidth="300">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!-- Telerik Windows8 Theme files -->
                <ResourceDictionary Source="pack://application:,,,/TelerikProject;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/TelerikProject;component/Themes/Telerik.Windows.Controls.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <telerik:RadButton Content="Test" Grid.Row="2" Width="75" Height="Auto" VerticalAlignment="Top" Margin="5"/>
        <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="0" Margin="5">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

                <!-- ERROR HAPPENS HERE. Probably isn't loading the MarkupExtension properly -->

                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=MainBrush}"/>
                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=BasicBrush}"/>
                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=AccentBrush}"/>
                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=StrongBrush}"/>
                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=ValidationBrush}"/>
                <Rectangle Width="20" Height="20" Fill="{telerik:Windows8Resource ResourceKey=MarkerBrush}"/>
            </StackPanel>
        </Border>
    </Grid>
</Window>

XamlParseException
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
at System.Windows.Baml2006.Baml2006SchemaContext.GetProperty(Int16 propertyId, XamlType parentType)
at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithConverter()
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
at System.Windows.Baml2006.Baml2006Reader.Read()
at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack\`1 stack, IStyleConnector styleConnector)
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, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at TelerikProject.WindowA.InitializeComponent() in <pathToProject>\TelerikProject\WindowA.xaml:line 1

Update
According to Rob Relyea's suggestion, I also tried calling this in code. The following works in both scenarios without error. I hope I'm recreating it right.
var rect = new Rectangle();
rect.Width = 20;
rect.Height = 20;

var ext = new Windows8ResourceExtension();
ext.ResourceKey = (Windows8ResourceKey)(new Windows8ResourceKeyTypeConverter().ConvertFrom("AccentBrush"));
var resourceReferenceExpression = ext.ProvideValue(new MockServiceProvider(rect));
var type = resourceReferenceExpression.GetType();
var mi = type.GetMethod("GetValue", BindingFlags.NonPublic | BindingFlags.Instance);
rect.Fill = (Brush)mi.Invoke(resourceReferenceExpression, new object[] { rect, Shape.FillProperty });

And ProvideValue wanted an IServiceProvider as a parameter. I'm guessing this would feed it the element and property it's applying to, so I mocked the provider to give the rectangle I created. (Is this right?)
public class MockServiceProvider : IServiceProvider
{
    private Rectangle _rect;

    public MockServiceProvider(Rectangle rect)
    {
        _rect = rect;
    }

    public object GetService(Type serviceType)
    {
        if(serviceType.Name == "IProvideValueTarget")
        {
            return new MockProviderTarget(_rect, Rectangle.FillProperty);
        }
        else
        {
            throw new NotImplementedException();
        }
    }
}

public class MockProviderTarget : IProvideValueTarget
{
    private object _targetObject;
    private object _targetProperty;

    public MockProviderTarget(object targetObject, object targetProperty)
    {
        _targetObject = targetObject;
        _targetProperty = targetProperty;
    }

    public object TargetObject {
        get
        {
            return _targetObject;
        }
    }

    public object TargetProperty {
        get
        {
            return _targetProperty;
        }
    }
}

A:

Try to take the xaml out of this. Build code to create that markup extension instance and then call providevalue(). My guess is that will fail when you launch the app the same way?  Likely telerik's code relies on something that changes with your two launch techniques. 

