Skip to content

Export Interface

Classes should implement their "ExportAttribute" interfaces

What does this mean ?

In the Attributed Programming Model, the ExportAttribute declares that a part exports, or provides to the composition container, an object that fulfills a particular contract. During composition, parts with imports that have matching contracts will have those dependencies filled by the exported object.

What can happen ?

If the type doesn't implement the interface it is exporting there will be an issue at runtime (either a cast exception or just a container not filled with the exported type) leading to unexpected behaviors/crashes. The rule raises an issue when a class doesn't implement or inherit the type declared in the ExportAttribute.


The type class should implement the interface it is exporting.

Sample Code

Vulnerable :

public class SomeType // Noncompliant; doesn't implement 'ISomeType'.

Non Vulnerable :

public class SomeType : ISomeType