Skip to content
代码片段 群组 项目
提交 793fb140 编辑于 作者: Jason Malinowski's avatar Jason Malinowski
浏览文件

Add a hack to ensure documents are connected to open files

In https://devdiv.visualstudio.com/DevDiv/_workitems/edit/728035, a file
is opened in an invisible editor and contents are written to it. The
file isn't saved, but it's added to the workspace; we won't have yet
hooked up to the open file since that work was deferred. Since we're on
the UI thread here, we can ensure those are all wired up since the
analysis of this document may depend on that other file. We choose to do
this here rather than in the project system code when it's added because
we don't want to pay the penalty of checking the RDT for all files being
opened on the UI thread if we really don't need it.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/728035.
上级 b3b459f2
No related branches found
No related tags found
无相关合并请求
......@@ -138,6 +138,11 @@ public void QueueCheckForFilesBeingOpen(ImmutableArray<string> newFileNames)
_openFileTrackerOpt?.QueueCheckForFilesBeingOpen(newFileNames);
}
public void ProcessQueuedWorkOnUIThread()
{
_openFileTrackerOpt?.ProcessQueuedWorkOnUIThread();
}
internal void AddProjectToInternalMaps(VisualStudioProject project, IVsHierarchy hierarchy, Guid guid, string projectSystemName)
{
lock (_gate)
......
......@@ -380,6 +380,15 @@ internal bool TryGetDocument(out Document document)
}
else
{
// HACK HACK HACK: Ensure we've processed all files being opened before we let designers work further.
// In https://devdiv.visualstudio.com/DevDiv/_workitems/edit/728035, a file is opened in an invisible editor and contents are written
// to it. The file isn't saved, but it's added to the workspace; we won't have yet hooked up to the open file since that work was deferred.
// Since we're on the UI thread here, we can ensure those are all wired up since the analysis of this document may depend on that other file.
// We choose to do this here rather than in the project system code when it's added because we don't want to pay the penalty of checking the RDT for
// all files being opened on the UI thread if we really don't need it. This uses an 'as' cast, because in unit tests the workspace is a different
// derived form of VisualStudioWorkspace, and there we aren't dealing with open files at all so it doesn't matter.
(State.Workspace as VisualStudioWorkspaceImpl)?.ProcessQueuedWorkOnUIThread();
document = Workspace.CurrentSolution.GetDocument(GetDocumentId());
}
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册