microsoft / vs-servicehub

The service broker libraries used by Visual Studio to exchange intra- and inter-process services
MIT License
20 stars 8 forks source link

Fix build failure when the new ISB004 analyzer is loaded by the VB compiler #243

Closed AArnott closed 4 weeks ago

AArnott commented 4 weeks ago

This corrects a regression from #242 that blocks insertion into VS.

The vbc.exe process doesn't know where to find C# code analysis assemblies. So the fact that our analyzer dll referenced the C#-specific assemblies meant this VB compiler break was just waiting to happen. The new ISB004 analyzer was the first to reference a C# syntax node in the analyzer itself, so its recent addition was what triggered the failure.

A tiny fix would have been to drop the C# reference, but that would have broken or reduced the precision with which the ISB004 analyzer could place the diagnostic's location. So instead, I went with the more future-looking change.

This change applies the same pattern that the vs-threading repo already uses for its analyzers: divide the analyzers assembly into language agnostic, C# and VB assemblies. We then need a new project to pack the 3 components into an analyzers package by the original name. I called this project "CodeFixes" because in the pattern from vs-threading, this is the name used. While it has no code fix providers in it at this time, this is the logical project to add them when and if we ever need them, which is where the project gets its name.

The changes to PublicAPI.Shipped.txt come from an update to the PublicApi analyzers that required an update as part of this change in order to match the pattern used by vs-threading.