Skip to content

[Sonic] Debugging and breakpoint bits - #84166

Merged
davidwengier merged 7 commits into
dotnet:features/sonicfrom
davidwengier:SonicDebugging
Jun 24, 2026
Merged

[Sonic] Debugging and breakpoint bits#84166
davidwengier merged 7 commits into
dotnet:features/sonicfrom
davidwengier:SonicDebugging

Conversation

@davidwengier

@davidwengier davidwengier commented Jun 17, 2026

Copy link
Copy Markdown
Member

This one has a little quirk where it wants the next C# mapping on a line, but since its the only place (left) that needs that behaviour, I decided to inline it since it's a bit complicated.

Microsoft Reviewers: Open in CodeFlow

…ervice

This method is only called from this one service, and I think its fundamentally broken in SONIC, because there is not
guarantee the "next" position comes from the same C# document, so I'm removing it from the general API as a first
step, so its easier to iterate.
@davidwengier
davidwengier requested a review from a team as a code owner June 17, 2026 06:42
Copilot AI review requested due to automatic review settings June 17, 2026 06:42

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 updates Razor cohost debugging-related services to correctly handle mapping between Razor source and the appropriate generated C# document (impl vs decl), and expands test coverage—particularly for Legacy (@functions) scenarios—now that cohosting is decl/impl split aware.

Changes:

  • Update remote debugging and datatip range services to map via RazorCodeDocument into the correct generated C# document (decl vs impl) before calling Roslyn breakpoint/datati​p helpers.
  • Simplify IDocumentMappingService by removing TryMapToCSharpPositionOrNext, and inline the specialized “next C# mapping on the same line” logic where it’s needed.
  • Re-enable and add cohost unit tests for code blocks and Legacy functions blocks across proximity expressions and breakpoint/breakable range scenarios.

Reviewed changes

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

Show a summary per file
File Description
src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/RemoteDebugInfoServiceTest.cs Re-enables previously skipped tests and adds Legacy @functions coverage; updates helpers to pass RazorFileKind.
src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostValidateBreakableRangeEndpointTest.cs Adds Legacy variants and threads optional RazorFileKind through test setup.
src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostDataTipRangeEndpointTest.cs Adds Legacy and block-kind coverage; threads optional RazorFileKind through test setup.
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/DocumentMappingService.cs Removes the “or next” mapping variant and simplifies internal mapping helper signature.
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Debugging/RemoteDebugInfoService.cs Uses decl/impl-aware mapping and inlines “map-or-next-on-line” logic that may span decl/impl docs.
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Debugging/RemoteDataTipRangeService.cs Uses decl/impl-aware mapping to select the correct generated document before datatip computation.
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs Adds a new convenience helper to map spans via either impl or decl C# documents.
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs Removes TryMapToCSharpPositionOrNext from the service contract.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 07:54

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

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

@davidwengier

Copy link
Copy Markdown
Member Author

@dotnet/razor-tooling PTAL, the other of the last two sonic tooling PRs

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