Skip to content

remove NotifyOfCrossThreadDependency call inside get_NoMessagePumpSynchronizationContext #1486

Merged
lifengl merged 1 commit intomainfrom
dev/lifengl/removeNotifyOfCrossThreadDependencyInSynchronizationContext
Sep 17, 2025
Merged

remove NotifyOfCrossThreadDependency call inside get_NoMessagePumpSynchronizationContext #1486
lifengl merged 1 commit intomainfrom
dev/lifengl/removeNotifyOfCrossThreadDependencyInSynchronizationContext

Conversation

@lifengl
Copy link
Copy Markdown
Member

@lifengl lifengl commented Sep 17, 2025

When a debugger is attached, NotifyOfCrossThreadDependency will freeze the thread to send notification to the debugger. Because this NoMessagePumpSynchronizationContext is heavily used, including nested inside code holding the JTF lock already, this logic to call this debugger notification in a very common code path leads the process being debugged becomes extremely slow when JTF is heavily used.

when a debugger is attached, NotifyOfCrossThreadDependency will freeze the thread to send notification to the debugger. Because this NoMessagePumpSynchronizationContext is heavily used, including nested inside code holding the JTF lock, this leads the process being debugged becomes extremely slow when JTF is heavily used.
{
get
{
// Callers of this method are about to take a private lock, which tends
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.

You could avoid the debugger hangs by adding [DebuggerBrowsable(DebuggerBrowsableState.Never)] to the property.

@lifengl lifengl merged commit 3c6bf80 into main Sep 17, 2025
9 checks passed
@lifengl lifengl deleted the dev/lifengl/removeNotifyOfCrossThreadDependencyInSynchronizationContext branch September 17, 2025 06:18
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.

2 participants