WPF Designer load failure with using IoC
===

I have a fairly simple and standard MVVM WPF app.  I am using TinyIoC as a containter to provide the underlying data and cache providers for the ViewModels.  I am using TinyIoC because I want to also share this code with MonoTouch and Monodroid projects.

Every user control who's ViewModels are not dependent on resolving a data provider from TinyIoC are working fine when added to the XAML of the MainWindow.  

The user controls who's ViewModels ARE using TinyIoC to resolve the data provider used get their data, cannot be instantiated in the designer view when added to the MainWindow.  

Important note: everything works fine when I run the app, just the designers are broken - a big impediment.

Here is the basic code:

        // From App.xaml.cs
        private void HandleAppStartupEvent(object sender, StartupEventArgs e) {
            IDataStoreProvider store = new XmlDataStoreProvider();
            ICacheProvider cache = new DictionaryCacheProvider();

            TinyIoCContainer.Current.Register(store);
            TinyIoCContainer.Current.Register(cache);
        }

View / ViewModel / XAML binding standard implementation - nothing an issue here.

Deeper in the depths of the data layer, the IoC container is used to resolve which provider to use - the one that was set in the above code.

    public static class Gateway
    {
        private static IDataStoreProvider store;
        private static ICacheProvider cache;

        static Gateway() {
            store = TinyIoCContainer.Current.Resolve<IDataStoreProvider>();
            cache = TinyIoCContainer.Current.Resolve<ICacheProvider>();
        }

        // use the store and cache here...

    }

Here is the exact error I get from the designer.

> Unable to resolve type: Sample.Core.Data.IDataStoreProvider
   at TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) in C:\_dev\Sample\SampleSolution\Sample.Core\Utility\TinyIoC.cs:line 3281
   at TinyIoC.TinyIoCContainer.Resolve(Type resolveType) in C:\_dev\Sample\SampleSolution\Sample.Core\Utility\TinyIoC.cs:line 1314
   at TinyIoC.TinyIoCContainer.Resolve[ResolveType]() in C:\_dev\Sample\SampleSolution\Sample.Core\Utility\TinyIoC.cs:line 1433
   at Sample.Core.Data.Gateway..cctor() in C:\_dev\Sample\SampleSolution\Sample.Core\Data\Gateway.cs:line 14



Again important to note, the app works fine - IoC and everything.  I would like to stop the designer loading error by either (in order of preference):

 - Understanding how to fix the code to properly work with the designer
 - Stub out the existing control data with mock data for the designer
 - Disabling this designer feature



   

 