-
Notifications
You must be signed in to change notification settings - Fork 90
Fix VSMEF007 #648
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
Merged
Merged
Fix VSMEF007 #648
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The previous code was treating unattributed properties on types as imports. It was re-using logic that applies to importing constructor parameters, which are implicitly imports even when unattributed. To fix this, we instruct the method that determines the contract as to whether implicit imports are relevant to the caller or not.
MEF uses both the contract type and name to identify a part. The prior code was essentially coalescing these into a single value when one was null. This meant that if the contract name matched a type name, then you could get a false positive for duplcate imports, where in fact the types differed. This was observed in the dotnet/project-system repo.
AArnott
approved these changes
Nov 24, 2025
src/Microsoft.VisualStudio.Composition.Analyzers/VSMEF007DuplicateImportAnalyzer.cs
Show resolved
Hide resolved
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
AArnott
reviewed
Nov 24, 2025
src/Microsoft.VisualStudio.Composition.Analyzers/VSMEF007DuplicateImportAnalyzer.cs
Show resolved
Hide resolved
Member
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 648 in repo microsoft/vs-mef |
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
AArnott
approved these changes
Nov 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes two issues in VSMEF007 (added in #603 and not yet released):