4

I have two export classes, that are located in separated assemblies.

When using [ImportMany], an exception during instantiating one exporter (in my case it is DB connection error that are thrown in constructor) of many leads to having a null set of [ImportMany] store.

I am expecting that there would be just one, correct instantiated, export in [ImportMany] (another one is crashed when trying to activate by MEF).

Is there any way to tune such behavior? Or any ways to load exporters one by one?

Thanks in advance, guys!

kseen
  • 359
  • 8
  • 56
  • 104

1 Answers1

1

Check this answer, maybe it helps. Theirs create theirs own catalog class SafeDirectoryCatalog that inherit from ComposablePartCatalog for manage the ReflectionTypeLoadException in a custom way. Hope it helps.

Community
  • 1
  • 1
Raúl Otaño
  • 4,640
  • 3
  • 31
  • 65
  • Thanks for your cooperation, but unfortunately, my assembly throws up an `CompositionException`. (The text of exception is `The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information...`) – kseen Oct 01 '14 at 17:01