I have used MEF with Prism before without issues. Now I try the simplest "stand-alone" MEF and I get problems.
I have 2 assemblies, one of them is a wpf application, the other is a lib (dll).
In the lib assembly one class (public, non-static) is named ExportedType and attributed with Export.
[Export]
public class ExportedType {... parameterless constructor here};
In the wpf assembly one class (the main window) has a field which is of the same type as the exported type mentioned above and is attributed with Import.
[Import]
public ExportedType exportedType;
In the wpf app OnStartup() method I set up the compositions as follows:
AssemblyCatalog catalogWithExports = new AssemblyCatalog(typeof(ExportedType).Assembly);
CompositionContainer container = new CompositionContainer(catalogWithExports);
But the exportedType field in the wpf assembly is always null (I am not trying to access it from the constructor of the main window).
What is the basics not working here ?
(output window does not give any clue, other tools available ?)