microsoft / vs-mef

Managed Extensibility Framework (MEF) implementation used by Visual Studio
MIT License
431 stars 87 forks source link

Analyze MEF exports for correctness #79

Open AArnott opened 6 years ago

AArnott commented 6 years ago

From @dgriffen on April 4, 2018 17:5

There should be a diagnostic checking if Export declarations are correct. For example:

[Export(typeof(IBar))]
public class Foo { }

This should be flagged as incorrect since Foo does not implement IBar

Copied from original issue: Microsoft/VSSDK-Analyzers#43

AArnott commented 6 years ago

Strictly speaking, the exported type is its type identity, which need to be implemented by the exported object. So this isn't actually an error. However it seems reasonable to report this as a warning since it is likely to be an authoring mistake. We don't have any analyzers in vs-mef at this point, but adding them sounds valuable.