Search Results

Search found 1 results on 1 pages for 'managedextensibilityframe'.

Page 1/1 | 1 

  • How can I prevent MEF from throwing an exception when an Export is not found?

    - by Kilhoffer
    I have a class with an IList<T> property decorated with the [ImportMany(allowRecomposition = true)] attribute. There are some conditions in which the application might not find any available Exports of the requested type. Right now, it's throwing a CompositionException if no Exports of the requested type are found. I dislike application flow being determined by thrown exceptions, so I would rather not catch and react in this case. Rather, I just want program execution to continue. Is there a flag or something I can set to make this Import optional? I know for single import properties, you can do this: [Import(AllowDefault = true)] but 'AllowDefault' is not an option on the ImportMany attribute.

    Read the article

1