Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zivkan opened this issue Jan 19, 2022 · 1 comment

Comments

@zivkan
Copy link
Member

zivkan commented Jan 19, 2022

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.

@AArnott
Copy link
Member

AArnott commented Jan 21, 2022

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 pushed a commit that referenced this issue Oct 30, 2024
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.11.0 to 17.11.1.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](microsoft/vstest@v17.11.0...v17.11.1)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants