Skip to content

Provide access to SymbolKey for TestDiscovery - #84643

Merged
peterwald merged 3 commits into
dotnet:mainfrom
peterwald:ext-symbolkey
Jul 27, 2026
Merged

peterwald merged 3 commits into
dotnet:mainfrom
peterwald:ext-symbolkey

Conversation

@peterwald

@peterwald peterwald commented Jul 27, 2026

Copy link
Copy Markdown
Member
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings July 27, 2026 15:22
@peterwald
peterwald requested a review from a team as a code owner July 27, 2026 15:22
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added VSCode Needs API Review Needs to be reviewed by the API review council labels Jul 27, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.TestDiscovery project (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.slnx to 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

Comment thread Roslyn.slnx
@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

Can you clarify how this helps?

Copilot AI review requested due to automatic review settings July 27, 2026 17:27
@peterwald
peterwald requested a review from a team as a code owner July 27, 2026 17:27
@peterwald

peterwald commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 0 new

@JoeRobich JoeRobich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for cleaning up the EA project!

@peterwald
peterwald enabled auto-merge (squash) July 27, 2026 18:03
@peterwald

Copy link
Copy Markdown
Member Author

/azp run roslyn-CI

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@dibarbet

dibarbet commented Jul 27, 2026

Copy link
Copy Markdown
Member

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.

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

@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

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.

@peterwald

Copy link
Copy Markdown
Member Author

@dibarbet

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

@CyrusNajmabadi

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.

@peterwald
peterwald merged commit 7c69ea6 into dotnet:main Jul 27, 2026
27 of 28 checks passed
GoldMikeDev pushed a commit to GoldMikeDev/FollyOfTheUnbound that referenced this pull request Jul 28, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs API Review Needs to be reviewed by the API review council VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants