msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

Refactor ProjectCacheService and fix various issues

Open dfederm opened this issue 1 year ago • 0 comments

This is a substantial refactor in the ProjectCacheService.

The primary motivation is to be more permissive with the plugins which are configured. Each project configures its plugins via an item, however today it's enforced that every project has exactly the same single plugin. This refactor relaxes that requirement such that each project may configure 0 to N plugins, and there is no requirement for any projects' configuration to match.

To accomplish this, many parts had to be rewritten (and honestly, simplified).

The biggest change is to how plugins are initialized and disposed of. Previously, the initialization would happen up front for graph builds and on-demand as a "VS Workaround" in the VS scenario. The disposal would also happen as part of the build itself once the core part of the build was done. With these changes, because we may not know all plugins which will be used in a build session, each plugin is initialized on demand as soon as it's discovered. Initialization is mostly the same, however each plugin is initialized in the background concurrently. The ProjectCacheService keeps track of all plugins used and disposes of them when the BuildManager is torn down. This means exceptions during plugin shutdown don't get seen in the build result but instead raised as an exception from the BuildManager.

In general I've also tried to reduce the "VS Workaround" code as much as possible, although there is still a pretty big hack in Evaluator which makes me die a little inside.

dfederm avatar Jul 16 '22 05:07 dfederm