-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove usage of weak-value-source for smart-open-scope references #58212
Remove usage of weak-value-source for smart-open-scope references #58212
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -32,7 +29,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) | |||
if (_singleton == null) | |||
{ | |||
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.