dotnet / dotnet/msbuild

Glob Caching should reuse results from multiple relative globs that resolve to the same directory

Open
#3,889 2 comments 0 reactions 0 assignees View on GitHub
Area: Performance backlog Feature - Globbing Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

Given

```
+---g
| a.cs
|
\---proj
+---a
| a.proj
|
\---b
\---c
c.proj
```

where

a.proj=
```xml






```

c.proj=
```xml






```

When glob caching is enabled (either by setting `MsBuildCacheFileEnumerations` to 1 or programatically by using a shared [EvaluationContext](https://github.com/Microsoft/msbuild/blob/master/src/Build/Evaluation/Context/EvaluationContext.cs)), both globs should reuse the same cached value, as they're pointing to same directory.

The tricky part is that, as #3890 shows, msbuild glob expansion results are not fully qualified paths, but rather the glob expansion gets prepended with the fixed directory portion from the item string (e.g. globs like `../a/*.cs` expand to `../a/b/c.cs`). This means that if we were to relative globs pointing to the same directory, we need to be able to "rebase" the glob expansion to different fixed directory parts.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the shared EvaluationContext in src/Build/Evaluation/Context/EvaluationContext.cs and trace the glob-caching path used when MsBuildCacheFileEnumerations is enabled. Compare the relative globs in the issue and the behavior described in #3890, focusing on how cached expansions retain fixed directory portions. Done means equivalent relative globs reuse one cached directory result while preserving each item's expected path form.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.