Exception with MefBootstrapper

Topics: Bootstrappers & IoC
May 2, 2012 at 6:57 PM

I'm getting the exception that "Could not locate any instances of contract" in the GetInstance method. I've exported the VM type and added [ImportingConstructor] to the constructor.

 

Oddly enough this was working fine until I added a child window to the project.

May 3, 2012 at 1:21 PM

Ok, I've figured this out after reading up on MEF. It seems my newest child window had a constructor that didn't have any imports/exports associated with them. Removed the offending object from the constructor and it works.