Skip to content

Fix VSMEF008 to emit fully-qualified type names in diagnostic messages#686

Merged
AArnott merged 2 commits intomainfrom
copilot/address-feedback-from-pr-682
Mar 3, 2026
Merged

Fix VSMEF008 to emit fully-qualified type names in diagnostic messages#686
AArnott merged 2 commits intomainfrom
copilot/address-feedback-from-pr-682

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

VSMEF008 diagnostic messages were showing only short type names, making it hard to identify which types were involved when names collide across namespaces.

Before:

warning VSMEF008: The contract type "SVsServiceProvider" is not assignable to the member type "IAsyncServiceProvider". The import may fail at runtime.

After:

warning VSMEF008: The contract type "Microsoft.VisualStudio.Shell.Interop.SVsServiceProvider" is not assignable to the member type "Microsoft.VisualStudio.Shell.IAsyncServiceProvider". The import may fail at runtime.

Changes

  • VSMEF008ImportContractTypeMismatchAnalyzer.cs: Replaced SymbolDisplayFormat.CSharpShortErrorMessageFormat with the existing FullyQualifiedTypeNameFormat (which uses NameAndContainingTypesAndNamespaces) when formatting both type arguments in the diagnostic message.
  • VSMEF008ImportContractTypeMismatchAnalyzerTests.cs: Added DiagnosticMessage_UsesFullyQualifiedTypeNames test that asserts diagnostic arguments contain namespace-qualified names.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • h8evsblobprodwus2120.vsblob.vsassets.io
    • Triggering command: /opt/hostedtoolcache/dotnet/dotnet /opt/hostedtoolcache/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/vs-mef/vs-mef/bin/Tests/Microsoft.VisualStudio.Composition.Analyzers.Tests/Release/net8.0/Microsoft.VisualStudio.Composition.Analyzers.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/vs-mef/vs-mef/bin/Tests/Microsoft.VisualStudio.Composition.Analyzers.Tests/Release/net8.0/Microsoft.VisualStudio.Composition.Analyzers.Tests.deps.json /home/REDACTED/work/vs-mef/vs-mef/bin/Tests/Microsoft.VisualStudio.Composition.Analyzers.Tests/Release/net8.0/testhost.dll --port 45841 --endpoint 127.0.0.1:045841 --role client --parentprocessid 5311 --telemetryoptedin false (dns block)
  • xofvsblobprodwus2114.vsblob.vsassets.io
    • Triggering command: /opt/hostedtoolcache/dotnet/dotnet dotnet build src/Microsoft.VisualStudio.Composition.Analyzers/Microsoft.VisualStudio.Composition.Analyzers.csproj -c Release --no-restore (dns block)
    • Triggering command: /opt/hostedtoolcache/dotnet/dotnet dotnet build test/Microsoft.VisualStudio.Composition.Analyzers.Tests/Microsoft.VisualStudio.Composition.Analyzers.Tests.csproj -c Release (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ssage

Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from PR #682 discussion Fix VSMEF008 to emit fully-qualified type names in diagnostic messages Mar 2, 2026
@AArnott AArnott marked this pull request as ready for review March 2, 2026 23:41
Copilot AI review requested due to automatic review settings March 2, 2026 23:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the usefulness of the VSMEF008 analyzer diagnostic by emitting namespace-qualified type names in the diagnostic message, reducing ambiguity when short type names collide across namespaces.

Changes:

  • Updated VSMEF008 analyzer to format both contract/member types using the existing FullyQualifiedTypeNameFormat.
  • Added a regression test asserting VSMEF008 diagnostic arguments contain namespace-qualified type names.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Microsoft.VisualStudio.Composition.Analyzers/VSMEF008ImportContractTypeMismatchAnalyzer.cs Switches diagnostic type formatting to a namespace-qualified SymbolDisplayFormat.
test/Microsoft.VisualStudio.Composition.Analyzers.Tests/VSMEF008ImportContractTypeMismatchAnalyzerTests.cs Adds a test validating the diagnostic message arguments use fully qualified type names.

@AArnott AArnott enabled auto-merge (squash) March 3, 2026 00:08
@AArnott AArnott merged commit c854523 into main Mar 3, 2026
13 checks passed
@AArnott AArnott deleted the copilot/address-feedback-from-pr-682 branch March 3, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants