Skip to content

Conversation

@ladipro
Copy link
Member

@ladipro ladipro commented Jun 19, 2023

Fixes #8636

Context

RAR uses a per-project disk cache to store data on referenced assemblies between executions. Per our common targets, for typical .NET projects the cache lives in obj/{configuration}/{tfm}/{project-file-name}.AssemblyReference.cache. The cache has currently non-deterministic contents, often containing more than what's actually needed. This is because items are effectively only added to and never removed from it.

Specific issues:

  • If the RAR pre-cache is used via AssemblyInformationCachePaths, its contents is copied into per-project caches of all affected projects, making them deserialize this - typically large amount of - data on each execution. The pre-cache shipped with the SDK is 2 MB in size.
  • The changes made in Don't save data on immutable files to per-project disk cache #8802 won't take effect until the developer cleans or rebuilds their project.
  • Changes to the project resulting in fewer references won't be reflected in the on-disk cache until the developer cleans or rebuilds the project.
  • Targets that use the cache file timestamp to implement incrementality may underbuild.

Changes Made

Made RAR keep track of which items are actually used. Made RAR save only the files that have actually been used. A special case of nothing worth persisting has been used results in no cache file written.

Testing

Existing and new unit tests. Manual verification using projects previously built without #8802.

Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to approve last time

@AR-May
Copy link
Member

AR-May commented Jun 21, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JanKrivanek JanKrivanek merged commit 730a792 into dotnet:main Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RAR: Save only relevant data to per project disk cache

4 participants