Skip to content

Fix lock contention in ProjectRootElementCache #13865

@AR-May

Description

@AR-May

Microsoft.Build.Evaluation.ProjectRootElementCache is protected by a single _locker that is acquired by every read and every write. All evaluator threads in a single MSBuild process converge on this lock for every resolution, capping in-process evaluation parallelism regardless of available cores.

Symptoms: Profiling shows ~1,600+ contention events on _locker

WeakValueDictionary is not thread-safe, so every lookup requires the lock. BoostEntryInStrongCache is O(n) and runs under the lock on every cache hit.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions