Skip to content

Commit 3990bca

Browse files
Clarify the comment on where the static is
1 parent ec90559 commit 3990bca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,9 @@ protected override void Dispose(bool finalize)
14201420
_textBufferFactoryService.TextBufferCreated -= AddTextBufferCloneServiceToBuffer;
14211421
_projectionBufferFactoryService.ProjectionBufferCreated -= AddTextBufferCloneServiceToBuffer;
14221422

1423-
// Make sure we unsubscribe this, or otherwise this will cause a leak in unit tests since the UIContext for SolutionClosing is a static that is shared
1424-
// across all tests.
1423+
// UIContext.FromUIContextGuid internally has a map from the GUID to the context object itself that is stored in a static;
1424+
// if we don't unsubscribe, it will leak our workspace object which can cause memory leaks in tests that create a whole MEF container
1425+
// per test.
14251426
_solutionClosingContext?.UIContextChanged -= SolutionClosingContext_UIContextChanged;
14261427
}
14271428

0 commit comments

Comments
 (0)