Skip to content

Cancellation management in InitializeApplicationAsync#9850

Merged
LittleLittleCloud merged 16 commits into
mainfrom
u/xiaoyun/fix#2630184
Nov 15, 2025
Merged

Cancellation management in InitializeApplicationAsync#9850
LittleLittleCloud merged 16 commits into
mainfrom
u/xiaoyun/fix#2630184

Conversation

@LittleLittleCloud
Copy link
Copy Markdown
Member

@LittleLittleCloud LittleLittleCloud commented Nov 13, 2025

InitializeApplicationAsync will wait named pipe connection from application forever in GetUpdateCapabilitiesAsync. This assumes that application always replies their capabilities back to hotreload client, which is not true in some corner cases, such as

  • application get terminated before it starts named pipe

This PR mitigate the forever waiting process by introducing a task cancellation source to InitializeApplicationAsync and return when either GetUpdateCapabilitiesAsync or cancellation token get cancelled.

- Added cancellation token support in ProjectHotReloadSessionManager to handle process exit scenarios gracefully.
- Introduced DebugTrace method for logging session activities in debug mode.
- Updated DeltaApplier to use TaskCompletionSource for better cancellation management during capability updates.
- Modified output window logging to include cancellation token in ProjectHotReloadSession.
@LittleLittleCloud LittleLittleCloud requested a review from a team as a code owner November 13, 2025 17:04
@LittleLittleCloud LittleLittleCloud changed the title Enhance Hot Reload session management and improve cancellation handling Cancellation management in InitializeApplicationAsync Nov 13, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@LittleLittleCloud
Copy link
Copy Markdown
Member Author

@copilot review pr

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 14, 2025

@LittleLittleCloud I've opened a new pull request, #9851, to work on those changes. Once the pull request is ready, I'll request review from you.

@LittleLittleCloud LittleLittleCloud merged commit a190760 into main Nov 15, 2025
5 checks passed
@LittleLittleCloud LittleLittleCloud deleted the u/xiaoyun/fix#2630184 branch November 15, 2025 00:52
@dotnet-policy-service dotnet-policy-service Bot added this to the 18.1 milestone Nov 15, 2025
@LittleLittleCloud
Copy link
Copy Markdown
Member Author

/backport to dev18.0.x

@github-actions
Copy link
Copy Markdown

Started backporting to dev18.0.x (link to workflow run)

@github-actions
Copy link
Copy Markdown

@LittleLittleCloud backporting to dev18.0.x failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Enhance Hot Reload session management and improve cancellation handling
Using index info to reconstruct a base tree...
M	src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/HotReload/ProjectHotReloadSessionManager.cs
M	src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/HotReload/ProjectHotReloadSession.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/HotReload/ProjectHotReloadSessionManager.cs
Auto-merging src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/HotReload/ProjectHotReloadSession.cs
Applying: Implement cancellation token workaround in InitializeApplicationAsync to handle client responsiveness
Applying: Add comment to clarify workaround for DefaultHotreloadClient cancellation token handling
Applying: Refactor cancellation handling in InitializeApplicationAsync to improve client responsiveness
Applying: Refactor Hot Reload session management to improve cancellation handling and responsiveness
error: sha1 information is lacking or useless (src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/HotReload/ProjectHotReloadSessionManager.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0005 Refactor Hot Reload session management to improve cancellation handling and responsiveness
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants