vs-mef icon indicating copy to clipboard operation
vs-mef copied to clipboard

Add analyzer to detect when a class has more than one `ImportingConstructor` attribute

Open zivkan opened this issue 4 years ago • 1 comments

A class I was modifying was long and the existing constructor wasn't at the top of the file, so I added another. I assume the error was written to the ComponentModelCache/Microsoft.VisualStudio.Default.err file, but neither compiling nor running the experimental instance gave me any indication about this error. I was just lucky that CI tests hit a code path where another component tried to import this class.

Anyway, if the analyzer checked for classes that have more than one [ImportingConstructor], this type of error would be caught more quickly.

zivkan avatar Jan 19 '22 00:01 zivkan

Agreed. We should first ensure that discovery on the part produces the error in the log for guaranteed discoverability without the help of analyzers and an open source project. An analyzer beyond that to prevent the bug in the first place is goodness as well.

AArnott avatar Jan 21 '22 23:01 AArnott