Provide access to SymbolKey for TestDiscovery - #84643
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
This PR modifies public API files. Please follow the instructions at https://github.com/dotnet/roslyn/blob/main/docs/contributing/API%20Review%20Process.md for ensuring all public APIs are reviewed before merging. |
There was a problem hiding this comment.
Pull request overview
This PR restructures the LanguageServer TestDiscovery external access surface by removing the dedicated Microsoft.CodeAnalysis.ExternalAccess.TestDiscovery project/package and shifting SymbolKey access into the existing Microsoft.CodeAnalysis.LanguageServer.ExternalAccess (Core) external-access assembly.
Changes:
- Removes the
Microsoft.CodeAnalysis.ExternalAccess.TestDiscoveryproject (and its type-forwarding/PublicAPI/InternalAPI tracking files) and drops references to it from the LanguageServer and LanguageServer.UnitTests projects. - Adds a TestDiscovery-facing symbol extension in ExternalAccess Core to expose
SymbolKey.Create(...).ToString()as a helper. - Updates
Roslyn.slnxto remove the deleted TestDiscovery ExternalAccess project.
Show a summary per file
| File | Description |
|---|---|
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj | Removes project reference to the deleted TestDiscovery ExternalAccess project. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Microsoft.CodeAnalysis.LanguageServer.UnitTests.csproj | Removes project reference to the deleted TestDiscovery ExternalAccess project. |
| src/LanguageServer/ExternalAccess/TestDiscovery/TypeForward.cs | Deletes the type-forwarding assembly source (project removed). |
| src/LanguageServer/ExternalAccess/TestDiscovery/PublicAPI.Unshipped.txt | Removes API tracking file along with deleted project. |
| src/LanguageServer/ExternalAccess/TestDiscovery/PublicAPI.Shipped.txt | Removes API tracking file along with deleted project. |
| src/LanguageServer/ExternalAccess/TestDiscovery/Microsoft.CodeAnalysis.ExternalAccess.TestDiscovery.csproj | Deletes the packable TestDiscovery ExternalAccess project/package. |
| src/LanguageServer/ExternalAccess/TestDiscovery/InternalAPI.Unshipped.txt | Removes internal API tracking file along with deleted project. |
| src/LanguageServer/ExternalAccess/TestDiscovery/InternalAPI.Shipped.txt | Removes internal API tracking file along with deleted project. |
| src/LanguageServer/ExternalAccess/Core/TestDiscovery/Internal/TestDiscoverySymbolExtensions.cs | Adds GetSymbolKeyString helper for TestDiscovery to produce SymbolKey strings. |
| Roslyn.slnx | Removes the deleted TestDiscovery ExternalAccess project from the solution. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 1
|
Can you clarify how this helps? |
SymbolKey is used by the source-based test discovery code. I need to expose this method to support adding the SBD implementation to C# Dev Kit. In particular, it is used by the code that serializes types for xUnit parameterized tests. |
JoeRobich
left a comment
There was a problem hiding this comment.
Thanks for cleaning up the EA project!
|
/azp run roslyn-CI |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Can you expand on the usage exactly? There are some reservations about exposing it as it isn't necessarily the most reliable, and there might be an alternative way |
|
Note: teh format definitely changes. But it also has a format version in it. So if you read a version you don't understand, it will fail gracefully. That said, consumptive code must be prepared for it to fail as that's a normal expectation whne saving strings from one version and reading in from another. |
We don't persist this string, nor do we parse it, it is used for the hashing algorithm that generates deterministic ids for test cases. As part of the id generation, we loop over the test arguments and hash the serialized values. For ITypeSymbol arguments it uses the SymbolKey. If it changes from one session to another, that's OK. It just needs to be stable during a development session for a particular type. This is the technique that is currently used in the Visual Studio variant of SBD as well. |
Upstream commit 7c69ea6 ("Provide access to SymbolKey for TestDiscovery", dotnet#84643) deleted the whole ExternalAccess.TestDiscovery project, folding its one file into ExternalAccess/Core, and updated Roslyn.slnx accordingly -- but this fork's separate FollyOfTheUnbound.slnx wasn't touched and still referenced the now-deleted csproj, breaking the CodeQL build (MSB4025: project file could not be loaded) once this merge lands. The ExternalAccess/Core project is already listed elsewhere in the filter, so the folded-in file is still covered.
Microsoft Reviewers: Open in CodeFlow