Skip to content

Export Interface

Classes are expected to implement their "ExportAttribute" interfaces.

What does this mean ?

The ExportAttribute in the Attributed Programming Model states that a component exports, or offers to the composition container, an object that meets a specific contract. Parts with imports that have matching contracts will have their dependencies supplied by the exported object during composition.

What can happen ?

If the type does not implement the interface it is exporting, there will be a problem at runtime (either a cast error or a container that is not filled with the exported type), resulting in unexpected behavior/crashes. When a class does not implement or inherit the type stated in the ExportAttribute, the rule throws an exception.


The interface that the type class is exporting should be implemented by the type class.

Sample Code

Vulnerable :

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

Non Vulnerable :

public class SomeType : ISomeType