Skip to content

Flush active recording when Dev Proxy shuts down. Closes #1945 - #1946

Merged
waldekmastykarz merged 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-stop-recording-on-exit
Oct 21, 2026
Merged

waldekmastykarz merged 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-stop-recording-on-exit

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

Closes #1945

Restores v3 behavior lost in the Kestrel migration: stopping Dev Proxy (Ctrl+C, devproxy stop, API) while recording now stops the recording first, so AfterRecordingStopAsync runs and plugins like HarGeneratorPlugin write their output.

  • InteractiveConsoleService.StopAsync stops the hotkey loop, then flushes the active recording. Hosted services stop in reverse registration order, so this runs before the proxy engine shuts down.
  • Added unit tests in InteractiveConsoleServiceTests.
  • Verified end-to-end: recorded a request, stopped the proxy, HAR file was created.
Restores v3 behavior: stopping the proxy (Ctrl+C, devproxy stop, API)
while recording now runs AfterRecordingStopAsync so plugins like
HarGeneratorPlugin still write their output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 545e4fa5-3816-4970-a2d0-8f8083d93163
Copilot AI balanced review requested due to automatic review settings October 21, 2026 11:46
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 21, 2026 11:46

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.

🟢 Approval recommended

No blocking issues remain; only a nonblocking shutdown-order documentation correction is needed.

1 open issue
What changed in this PR

Restores recording export on shutdown after the Kestrel migration, addressing #1945.

Changes:

  • Stops the hotkey loop, then awaits completion of any active recording.
  • Adds tests for shutdown with and without active recording.
File Description
DevProxy/​Proxy/​InteractiveConsoleService.cs Flushes active recording during shutdown so plugins can export output.
DevProxy.Tests/​InteractiveConsoleServiceTests.cs Tests conditional recording shutdown.

Review effort: Balanced

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@waldekmastykarz
waldekmastykarz merged commit 43b3724 into dotnet:main Oct 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants