Posts Tagged ‘MEF’

More than one export was found that matches the constraint

When using MEF, you might one day find a class that is marked as export is not exported. Having a look at the trace window in VS, there is a line as:

More than one export was found that matches the constraint:
ContractName XXXX
RequiredTypeIdentity XXXX

Resulting in: Cannot set import ‘YYYY..ctor (Parameter=”operand1″, ContractName=”XXXX”)’ on part ‘YYYY’.
Read the rest of this entry »

Tags:

Lifetime of parts created by MEF container

You might be confused that when lifetime of parts that are created by MEF container.GetExportedValues appeared to be NOT controlled by their container. the confusion comes from that fact that most of MEF documentations have not mentioned that parts could be referenced by other objects in your system apart from container, in that case, container will not be responsible for life time of parts SOLELY. Read the rest of this entry »

Tags: