dotnet / dotnet/msbuild

ProjectCachePlugin might not get properly finlized

Open
#11,490 0 comments 0 reactions 0 assignees View on GitHub
Area: Project Cache needs-design Priority:1 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

Details [in discussion here](https://teams.microsoft.com/l/message/19:3212bf033f4c4b5198643a04fa1048fa@thread.skype/1740085787606?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=4ba7372f-2799-4677-89f0-7a1aaea3706c&parentMessageId=1740085787606&teamName=.NET%20Developer%20Experience&channelName=MSBuild&createdTime=1740085787606)

### Manifestation

Error in VS:

```
2>MSBUILD : error : Another instance of MSBuildCache is already running in this build. This is typically due to a misconfiguration of the plugin settings, in particular different plugin settings across projects.
```

### Cause

`ProjectCacheService.CreateAndInitializePluginAsync` creates an instance of `ProjectCachePluginBase`, but if the later initialization of the plugin (e.g. `BeginBuildAsync`) throws - the plugin is not properly 'discarded' (via call to `EndBuildAsync`).

### What needs to be done

A proper design of error contract between cache service and cache plugin needs to be defined. Specifically: what happens and is guaranteed when unrecoverable errors in between BuildManager.BeginBuild and BuildManager.EndBuild happens and the BuildManager.EndBuild is actually never called

The design needs to be sticked through by the ProjectCacheService (and the actual plugins)

FYI @dfederm

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.