MeffedMVVM ViewModel resolver null w/o debugger

Feb 3, 2012 at 8:18 PM

I'm building my first cinch app, and if I run my project with the debugger, it works fine.

However, if I run without the debugger, it will crash when attempting to do this in Cinch's PopupResolver.cs. (originally it was throwing an exception, but I removed the try-catches to see exactly where is was failing)

                 uiVisualizerService =              ViewModelRepository.Instance.Resolver.Container.GetExport<IUIVisualizerService>().Value;

If I launch the debugger after the crash, I see that the "Instance" is set to an object, but the "Resolver" is null.

(If I run with debugger, I see that the "Resolver" is in fact, set to an object).


Also, I can run the cinch demo project without the debugger just fine.

Am I missing something related to the setup of MEF?




Feb 5, 2012 at 9:17 AM



I think as long as you follow what is done in the WPF demo, see App.xaml.cs for example. All should be ok.


Its not set to "Client Profile" or something like that is it?


Also since you are having issues with "Resolver", that is a more a question for Marlon Grech as he is author of MefedMVVM. I would not know why that should not work. I just take a dependency on MefedMVVM, so don't know its internals that well. I am kind of reliant on it workin correctly, if it doesn't I would need to grab its source and step into it. 


Sorry to say, but that is what you may have to do, MefedMVVM is kind of out of my hands. Sorry

Feb 6, 2012 at 6:46 PM
Edited Feb 6, 2012 at 6:52 PM

I also have this issue from time to time, but, how Sacha said, it is not a problem of Cinch.

Please check:

1.) Is it possible that any ctor of your ExportViewModel() - classes fails? I try to avoid any operations in ctors, that can throw an exceptions. I always use the ViewAwareStatus.ViewLoaded - Event for these operations.

2.) Have you any assemblies in output dir, that can't be loaded, e.g. because they have dependencys to other (missed) dlls?

3.) The Debug output. MefedMVVM writes a log in case of instanciating fails.

MefedMVVM should be throw these errors in an convient way, but this is not Sachas job.

Kurt, are you from germany?


Feb 7, 2012 at 12:18 AM

thanks for the suggestions guys, I will look into them.  I realize that my problem is probably not related to cinch, I just thought maybe someone else had run into the same error using the cinch/MefedMVVM combination.

I do know that It's not a Client Profile problem.  I'll look into mefed log file and then start excluding classes from the build until it loads without error.


Christoph - I'm from the USA.

Sacha - thanks for the excellent framework. All your articles and demo walkthroughs have really helped me get my mind around practical MVVM!

Feb 7, 2012 at 8:39 AM



No worries for Cinch, it was born out of a real need I had, I just hoped it helped other people, and it seems to have. Although its not as popular as some other MVVM frameworks (such as MVVMLight), I feel Cinch does more. Which may or may not be a good thing, depends on your angle on that one.


But I feel Cinch hits the sweet spot