Rule Definition
In order for an import to be matched with an export, the import and export must have the same contract. The contract consists of a string, called the contract name, and the type of the exported or imported object, called the contract type. Only if both the contract name and contract type match is an export considered to fulfill a particular import.
Remediation
Ensure your classes implement the export interface properly.
Violation Code Sample
[Export(typeof(IMyAddin))]
public class MyLogger // does not implement IMyAddin
{
}
Fixed Code Sample
[Export(typeof(IMyAddin))]
public class MyLogger : IMyAddin
{
}
Reference
https://docs.microsoft.com/dotnet/framework/mef/attributed-programming-model-overview-mef
Related Technologies
Technical Criterion
Programming Practices - OO Inheritance and Polymorphism
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.