Skip to content

Debugger.NotifyOfCrossThreadDependency can be slow when a debugger is attached #38736

@gregg-miskelly

Description

@gregg-miskelly

Description

Certain code paths will call Debugger.NotifyOfCrossThreadDependency. NotifyOfCrossThreadDependency is pretty close to free when there is no debugger attached, so if you are in a situation where you do something cheap which calls NotifyOfCrossThreadDependency then you can have a very high overhead for the with debugger case compared to the without case. Recently one such case surfaced with Task completion: https://developercommunity.visualstudio.com/content/problem/1097088/attaching-debugger-to-heavily-async-process-causes.html

Ideally, we would avoid notifying the debugger if NotifyOfCrossThreadDependency was called when a func-eval wasn't happening.

Stack

Metadata

Metadata

Assignees

Labels

area-Diagnostics-coreclrenhancementProduct code improvement that does NOT require public API changes/additionsin-prThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions