Skip to content

Remove usage of weak-value-source for smart-open-scope references#58212

Merged
CyrusNajmabadi merged 2 commits intodotnet:mainfrom
CyrusNajmabadi:removeWeakValueSOurces
Dec 10, 2021
Merged

Remove usage of weak-value-source for smart-open-scope references#58212
CyrusNajmabadi merged 2 commits intodotnet:mainfrom
CyrusNajmabadi:removeWeakValueSOurces

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

A/B testing (2000 people in each group) revealed no interesting change from just turning this off. My theory here is that for projecs that reference dlls from standard runtime locations, there is very little removal of said dlls, and the compiler ends up rooting all these assemblies anyways through any metadata symbols we have.

Also, because we are using the open-scope-system, the platform effectively does hteir memory mapping once and keeps that memory around forever (in case other components need it, or roslyn needs it again). So that is also effectively a fixed cost that won't ever be given back.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 9, 2021 18:39
@ghost ghost added the Area-IDE label Dec 9, 2021
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

And There Was Much Rejoicing

{
var temporaryStorage = workspaceServices.GetService<ITemporaryStorageService>();
Interlocked.CompareExchange(ref _singleton, new VisualStudioMetadataReferenceManager(workspaceServices.Workspace, _serviceProvider, temporaryStorage), null);
Interlocked.CompareExchange(ref _singleton, new VisualStudioMetadataReferenceManager(_serviceProvider, temporaryStorage), null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❗ This incorrectly provides a VisualStudioMetadataReferenceManager using the ITemporaryStorageService from an unrelated workspace. The cache field needs to be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This bug isn't introduced by this pull request, but if you aren't fixing it here please file a bug for the 17.1 release.

@CyrusNajmabadi CyrusNajmabadi merged commit bea10ea into dotnet:main Dec 10, 2021
@ghost ghost added this to the Next milestone Dec 10, 2021
@Cosifne Cosifne modified the milestones: Next, 17.1.P3 Jan 5, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the removeWeakValueSOurces branch February 1, 2022 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants