In the basic scenario in which part A has a dependency on part B, and both part A and part B have methods with [OnImportsSatisfied] attributes, the method in part A is called before that in part B. This is completely wrong as part A's imports aren't satisfied until part B is ready. And until part B's [OnImportsSatisfied] method is called, it isn't ready. The older version of MEF (System.ComponentModel.Composition) included with Visual Studio handles this correctly on the other hand.
Repro:
http://pastebin.com/SVFUJ2zN
Expected behaviour
From C (as C has no dependencies)
From B (as C, B's only dependency, is now resolved)
From A (as B, A's only dependency, is now resolved)
Actual behaviour:
From A (wrong as B has not yet resolved)
From B (wrong as C has not yet resolved)
From C
Comments: This breaks in many real-world scenarios. If, for instance, an import for a graphics context sets up managed resources ready for other components to use in its OnImportsSatisfied method, and another component loads content using that context in its OnImportsSatisfied method, the component trying to load content initializes first, before the graphics context has initialized.
Repro:
http://pastebin.com/SVFUJ2zN
Expected behaviour
From C (as C has no dependencies)
From B (as C, B's only dependency, is now resolved)
From A (as B, A's only dependency, is now resolved)
Actual behaviour:
From A (wrong as B has not yet resolved)
From B (wrong as C has not yet resolved)
From C
Comments: This breaks in many real-world scenarios. If, for instance, an import for a graphics context sets up managed resources ready for other components to use in its OnImportsSatisfied method, and another component loads content using that context in its OnImportsSatisfied method, the component trying to load content initializes first, before the graphics context has initialized.